[glib: 6/26] gdatetime: Deprecate GDateTime API which uses GTimeVal



commit e971b25c6ad1e32599f1a9c73f9f942b68f574b4
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Jun 18 12:34:30 2019 +0100

    gdatetime: Deprecate GDateTime API which uses GTimeVal
    
    GTimeVal is not year-2038-safe.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    Helps: #1438

 glib/gdatetime.c | 14 ++++++++++++++
 glib/gdatetime.h | 10 +++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/glib/gdatetime.c b/glib/gdatetime.c
index 5b09c1854..b0cea6333 100644
--- a/glib/gdatetime.c
+++ b/glib/gdatetime.c
@@ -854,6 +854,7 @@ g_date_time_replace_days (GDateTime *datetime,
 
 /* now/unix/timeval Constructors {{{1 */
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 /*< internal >
  * g_date_time_new_from_timeval:
  * @tz: a #GTimeZone
@@ -887,6 +888,7 @@ g_date_time_new_from_timeval (GTimeZone      *tz,
   return g_date_time_from_instant (tz, tv->tv_usec +
                                    UNIX_TO_INSTANT (tv->tv_sec));
 }
+G_GNUC_END_IGNORE_DEPRECATIONS
 
 /*< internal >
  * g_date_time_new_from_unix:
@@ -1084,7 +1086,10 @@ g_date_time_new_from_unix_utc (gint64 t)
  * Returns: a new #GDateTime, or %NULL
  *
  * Since: 2.26
+ * Deprecated: 2.62: #GTimeVal is not year-2038-safe. Use
+ *    g_date_time_new_from_unix_local() instead.
  **/
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 GDateTime *
 g_date_time_new_from_timeval_local (const GTimeVal *tv)
 {
@@ -1097,6 +1102,7 @@ g_date_time_new_from_timeval_local (const GTimeVal *tv)
 
   return datetime;
 }
+G_GNUC_END_IGNORE_DEPRECATIONS
 
 /**
  * g_date_time_new_from_timeval_utc:
@@ -1116,7 +1122,10 @@ g_date_time_new_from_timeval_local (const GTimeVal *tv)
  * Returns: a new #GDateTime, or %NULL
  *
  * Since: 2.26
+ * Deprecated: 2.62: #GTimeVal is not year-2038-safe. Use
+ *    g_date_time_new_from_unix_utc() instead.
  **/
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 GDateTime *
 g_date_time_new_from_timeval_utc (const GTimeVal *tv)
 {
@@ -1129,6 +1138,7 @@ g_date_time_new_from_timeval_utc (const GTimeVal *tv)
 
   return datetime;
 }
+G_GNUC_END_IGNORE_DEPRECATIONS
 
 /* Parse integers in the form d (week days), dd (hours etc), ddd (ordinal days) or dddd (years) */
 static gboolean
@@ -2533,7 +2543,10 @@ g_date_time_to_unix (GDateTime *datetime)
  * Returns: %TRUE if successful, else %FALSE
  *
  * Since: 2.26
+ * Deprecated: 2.62: #GTimeVal is not year-2038-safe. Use
+ *    g_date_time_to_unix() instead.
  **/
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 gboolean
 g_date_time_to_timeval (GDateTime *datetime,
                         GTimeVal  *tv)
@@ -2543,6 +2556,7 @@ g_date_time_to_timeval (GDateTime *datetime,
 
   return TRUE;
 }
+G_GNUC_END_IGNORE_DEPRECATIONS
 
 /* Timezone queries {{{1 */
 /**
diff --git a/glib/gdatetime.h b/glib/gdatetime.h
index af42c7fc6..fa43d8531 100644
--- a/glib/gdatetime.h
+++ b/glib/gdatetime.h
@@ -113,10 +113,12 @@ GDateTime *             g_date_time_new_from_unix_local                 (gint64
 GLIB_AVAILABLE_IN_ALL
 GDateTime *             g_date_time_new_from_unix_utc                   (gint64          t);
 
-GLIB_AVAILABLE_IN_ALL
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_unix_local)
 GDateTime *             g_date_time_new_from_timeval_local              (const GTimeVal *tv);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_unix_utc)
 GDateTime *             g_date_time_new_from_timeval_utc                (const GTimeVal *tv);
+G_GNUC_END_IGNORE_DEPRECATIONS
 
 GLIB_AVAILABLE_IN_2_56
 GDateTime *             g_date_time_new_from_iso8601                    (const gchar    *text,
@@ -238,9 +240,11 @@ gdouble                 g_date_time_get_seconds                         (GDateTi
 
 GLIB_AVAILABLE_IN_ALL
 gint64                  g_date_time_to_unix                             (GDateTime      *datetime);
-GLIB_AVAILABLE_IN_ALL
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_to_unix)
 gboolean                g_date_time_to_timeval                          (GDateTime      *datetime,
                                                                          GTimeVal       *tv);
+G_GNUC_END_IGNORE_DEPRECATIONS
 
 GLIB_AVAILABLE_IN_ALL
 GTimeSpan               g_date_time_get_utc_offset                      (GDateTime      *datetime);


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