[gnome-notes/133-gtimeval-deprecation] date-time: GTimeVal Deprecation



commit e0b6a3e4ac0c1b892923927b272b0696a862e853
Author: Isaque Galdino <igaldino gmail com>
Date:   Tue Sep 3 17:33:23 2019 -0300

    date-time: GTimeVal Deprecation

 src/libbiji/biji-date-time.c | 11 +++++++----
 src/libbiji/biji-date-time.h |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/libbiji/biji-date-time.c b/src/libbiji/biji-date-time.c
index 0d0e10d..c641ffb 100644
--- a/src/libbiji/biji-date-time.c
+++ b/src/libbiji/biji-date-time.c
@@ -69,10 +69,13 @@ biji_get_time_diff_with_time (glong sec_since_epoch)
 
 
 gint64
-iso8601_to_gint64 (gchar *iso8601)
+iso8601_to_gint64 (const char *iso8601)
 {
-  GTimeVal time = {0,0};
+  g_autoptr(GDateTime) dt = g_date_time_new_from_iso8601 (iso8601, NULL);
+  if (dt == NULL)
+    {
+      return 0;
+    }
 
-  g_time_val_from_iso8601 (iso8601, &time);
-  return (gint64) time.tv_sec;
+  return g_date_time_to_unix (dt);
 }
diff --git a/src/libbiji/biji-date-time.h b/src/libbiji/biji-date-time.h
index 7dd3983..89e7203 100644
--- a/src/libbiji/biji-date-time.h
+++ b/src/libbiji/biji-date-time.h
@@ -25,4 +25,4 @@ const gchar      *biji_get_time_diff_with_time            (glong sec_since_epoch
 
 
 
-gint64            iso8601_to_gint64                       (gchar *iso8601);
+gint64            iso8601_to_gint64                       (const char *iso8601);


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