From 5c4b48f4669bbd9dab7517ab0991d15f9781653f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sat, 1 Jan 2022 11:56:16 +0100 Subject: [PATCH] Use microseconds for log dates only if supported Fixes #3071. --- src/utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils.c b/src/utils.c index 6f7cb5b08f..a8db132536 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1049,6 +1049,10 @@ gint utils_parse_color_to_bgr(const gchar *spec) * The returned string should be freed with g_free(). */ gchar *utils_get_current_time_string(gboolean include_microseconds) { + // "%f" specifier for microseconds is only available since GLib 2.66 + if (glib_check_version(2, 66, 0) != NULL) + include_microseconds = FALSE; + GDateTime *now = g_date_time_new_now_local(); const gchar *format = include_microseconds ? "%H:%M:%S.%f" : "%H:%M:%S"; gchar *time_string = g_date_time_format(now, format);