From ff42c9417461c7da4a940a52a08573931880337e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 31 Jul 2020 11:22:16 -0400 Subject: [PATCH] gtkicontheme: Stop using GTimeVal It has been deprecated and the deprecation warnings break our -Werror build in ci. --- gtk/gtkicontheme.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 2ce6dbe76f..cd1010376d 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -332,7 +332,7 @@ struct _GtkIconTheme GtkSettings *display_settings; /* time when we last stat:ed for theme changes */ - glong last_stat_time; + gint64 last_stat_time; GArray *dir_mtimes; gulong theme_changed_idle; @@ -1966,7 +1966,6 @@ load_themes (GtkIconTheme *self) int base; char *dir; const char *file; - GTimeVal tv; GStatBuf stat_buf; int j; @@ -2029,8 +2028,7 @@ load_themes (GtkIconTheme *self) self->themes_valid = TRUE; - g_get_current_time (&tv); - self->last_stat_time = tv.tv_sec; + self->last_stat_time = g_get_monotonic_time (); GTK_DISPLAY_NOTE (self->display, ICONTHEME, { GList *l; @@ -2051,14 +2049,13 @@ static gboolean ensure_valid_themes (GtkIconTheme *self, gboolean non_blocking) { - GTimeVal tv; gboolean was_valid = self->themes_valid; if (self->themes_valid) { - g_get_current_time (&tv); + gint64 now = g_get_monotonic_time (); - if (ABS (tv.tv_sec - self->last_stat_time) > 5) + if ((now - self->last_stat_time) / G_USEC_PER_SEC > 5) { if (non_blocking) return FALSE; @@ -2749,7 +2746,6 @@ rescan_themes (GtkIconTheme *self) { int stat_res; GStatBuf stat_buf; - GTimeVal tv; guint i; for (i = 0; i < self->dir_mtimes->len; i++) @@ -2771,8 +2767,7 @@ rescan_themes (GtkIconTheme *self) return TRUE; } - g_get_current_time (&tv); - self->last_stat_time = tv.tv_sec; + self->last_stat_time = g_get_monotonic_time (); return FALSE; }