From 626b6f5ea7704af566b59867218bf48282f6dd49 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 18 Jun 2019 12:35:41 +0100 Subject: [PATCH] gmain: Deprecate g_get_current_time() because it uses GTimeVal GTimeVal is not year-2038-safe. Signed-off-by: Philip Withnall Helps: #1438 --- glib/gmain.c | 5 +++++ glib/gmain.h | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/glib/gmain.c b/glib/gmain.c index afaad918d..2b95631d0 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -2631,7 +2631,11 @@ g_source_query_unix_fd (GSource *source, * Equivalent to the UNIX gettimeofday() function, but portable. * * You may find g_get_real_time() to be more convenient. + * + * Deprecated: 2.62: #GTimeVal is not year-2038-safe. Use g_get_real_time() + * instead. **/ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS void g_get_current_time (GTimeVal *result) { @@ -2664,6 +2668,7 @@ g_get_current_time (GTimeVal *result) result->tv_usec = time64 % 1000000; #endif } +G_GNUC_END_IGNORE_DEPRECATIONS /** * g_get_real_time: diff --git a/glib/gmain.h b/glib/gmain.h index e9cb7d2d4..d6f51533c 100644 --- a/glib/gmain.h +++ b/glib/gmain.h @@ -570,8 +570,11 @@ GSource *g_timeout_source_new_seconds (guint interval); /* Miscellaneous functions */ -GLIB_AVAILABLE_IN_ALL +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED_IN_2_62_FOR(g_get_real_time) void g_get_current_time (GTimeVal *result); +G_GNUC_END_IGNORE_DEPRECATIONS + GLIB_AVAILABLE_IN_ALL gint64 g_get_monotonic_time (void); GLIB_AVAILABLE_IN_ALL