From 2cd05c1bd843c54a88b76305da3dff6eb1a347fe Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 20 Feb 2020 10:36:18 -0800 Subject: [PATCH] libsysprof-capture: fallback to g_time_val_to_iso8601() To allow us to backport to older systems, we can have a fallback here for the time being. --- src/libsysprof-capture/sysprof-capture-writer.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libsysprof-capture/sysprof-capture-writer.c b/src/libsysprof-capture/sysprof-capture-writer.c index 5d8b38aa..8e4c5a61 100644 --- a/src/libsysprof-capture/sysprof-capture-writer.c +++ b/src/libsysprof-capture/sysprof-capture-writer.c @@ -488,7 +488,17 @@ sysprof_capture_writer_new_from_fd (int fd, self->next_counter_id = 1; now = g_date_time_new_now_local (); + +#if GLIB_CHECK_VERSION(2, 62, 0) nowstr = g_date_time_format_iso8601 (now); +#else + { + GTimeVal tv; + + g_date_time_to_timeval (now, &tv); + nowstr = g_time_val_to_iso8601 (&tv); + } +#endif header = sysprof_capture_writer_allocate (self, &header_len);