[gnome-power-manager: 1/2] Closes: https://gitlab.gnome.org/GNOME/gnome-power-manager/-/issues/10




commit d30ce8d563aaf876048d56cad74f283b2d24d7f4
Author: agurk <22186-agurk users noreply gitlab gnome org>
Date:   Thu Feb 4 12:19:54 2021 +0000

    Closes: https://gitlab.gnome.org/GNOME/gnome-power-manager/-/issues/10

 src/gpm-statistics.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c
index a3d7a265..5aa420ea 100644
--- a/src/gpm-statistics.c
+++ b/src/gpm-statistics.c
@@ -727,8 +727,7 @@ gpm_stats_update_info_page_history (UpDevice *device)
        gboolean points;
        EggGraphPoint *point;
        GPtrArray *new;
-       gint32 offset = 0;
-       GTimeVal timeval;
+       gint64 offset = 0;
 
        new = g_ptr_array_new_with_free_func ((GDestroyNotify) egg_graph_point_free);
        if (g_strcmp0 (history_type, GPM_HISTORY_CHARGE_VALUE) == 0) {
@@ -778,8 +777,8 @@ gpm_stats_update_info_page_history (UpDevice *device)
        gtk_widget_hide (widget);
        gtk_widget_show (graph_history);
 
-       g_get_current_time (&timeval);
-       offset = timeval.tv_sec;
+       /* convert microseconds to seconds */
+       offset = g_get_real_time() / 1000000;
 
        for (i = 0; i < array->len; i++) {
                item = (UpHistoryItem *) g_ptr_array_index (array, i);
@@ -789,7 +788,7 @@ gpm_stats_update_info_page_history (UpDevice *device)
                        continue;
 
                point = egg_graph_point_new ();
-               point->x = (gint32) up_history_item_get_time (item) - offset;
+               point->x = (gint) up_history_item_get_time (item) - offset;
                point->y = up_history_item_get_value (item);
                if (up_history_item_get_state (item) == UP_DEVICE_STATE_CHARGING)
                        point->color = gpm_color_from_rgb (255, 0, 0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]