[libsoup/gtimeval-deprecate] SoupDate: deprecate soup_date_to_timeval()



commit 5dd1a1d0607c2787c3350f6254c36817a078db98
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Thu Jan 16 13:06:38 2020 +0200

    SoupDate: deprecate soup_date_to_timeval()
    
    GTimeVal has been deprecated and shouldn't be used, so deprecate
    soup_date_to_timeval().

 libsoup/soup-date.c       | 4 ++++
 libsoup/soup-date.h       | 3 +++
 libsoup/soup-version.h.in | 7 +++++++
 3 files changed, 14 insertions(+)
---
diff --git a/libsoup/soup-date.c b/libsoup/soup-date.c
index 92e46ebb..1b88b962 100644
--- a/libsoup/soup-date.c
+++ b/libsoup/soup-date.c
@@ -722,6 +722,7 @@ soup_date_to_time_t (SoupDate *date)
        return (time_t) (sizeof (time_t) == 4 ? MIN(seconds, G_MAXINT32) : seconds);
 }
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 /**
  * soup_date_to_timeval:
  * @date: a #SoupDate
@@ -729,6 +730,8 @@ soup_date_to_time_t (SoupDate *date)
  *
  * Converts @date to a #GTimeVal.
  *
+ * Deprecated: Do not use #GTimeVal, as it's not Y2038-safe.
+ *
  * Since: 2.24
  */
 void
@@ -743,6 +746,7 @@ soup_date_to_timeval (SoupDate *date, GTimeVal *time)
        time->tv_sec = ((((time->tv_sec * 24) + date->hour) * 60) + date->minute) * 60 + date->second;
        time->tv_usec = 0;
 }
+G_GNUC_END_IGNORE_DEPRECATIONS
 
 /**
  * soup_date_is_past:
diff --git a/libsoup/soup-date.h b/libsoup/soup-date.h
index 04d65e8d..631e700d 100644
--- a/libsoup/soup-date.h
+++ b/libsoup/soup-date.h
@@ -59,11 +59,14 @@ char     *soup_date_to_string       (SoupDate       *date,
 SOUP_AVAILABLE_IN_2_24
 time_t    soup_date_to_time_t       (SoupDate       *date);
 
+#ifndef SOUP_DISABLE_DEPRECATED
 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 SOUP_AVAILABLE_IN_2_24
+SOUP_DEPRECATED_IN_2_70
 void      soup_date_to_timeval      (SoupDate       *date,
                                     GTimeVal       *time);
 G_GNUC_END_IGNORE_DEPRECATIONS
+#endif
 
 SOUP_AVAILABLE_IN_2_24
 gboolean  soup_date_is_past         (SoupDate       *date);
diff --git a/libsoup/soup-version.h.in b/libsoup/soup-version.h.in
index fc24f3cb..149a4ea8 100644
--- a/libsoup/soup-version.h.in
+++ b/libsoup/soup-version.h.in
@@ -68,6 +68,7 @@ G_BEGIN_DECLS
 #define SOUP_VERSION_2_62 (G_ENCODE_VERSION (2, 62))
 #define SOUP_VERSION_2_66 (G_ENCODE_VERSION (2, 66))
 #define SOUP_VERSION_2_68 (G_ENCODE_VERSION (2, 68))
+#define SOUP_VERSION_2_70 (G_ENCODE_VERSION (2, 70))
 
 /* evaluates to the current stable version; for development cycles,
  * this means the next stable target
@@ -396,6 +397,12 @@ G_BEGIN_DECLS
 # define SOUP_AVAILABLE_IN_2_68                 _SOUP_EXTERN
 #endif
 
+#if SOUP_VERSION_MIN_REQUIRED >= SOUP_VERSION_2_70
+# define SOUP_DEPRECATED_IN_2_70                G_DEPRECATED
+#else
+# define SOUP_DEPRECATED_IN_2_70
+#endif
+
 SOUP_AVAILABLE_IN_2_42
 guint    soup_get_major_version (void);
 


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