[sysprof] libsysprof-capture: fallback to g_time_val_to_iso8601()



commit 2cd05c1bd843c54a88b76305da3dff6eb1a347fe
Author: Christian Hergert <chergert redhat com>
Date:   Thu Feb 20 10:36:18 2020 -0800

    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 5d8b38a..8e4c5a6 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);
 


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