gmain: Deprecate g_get_current_time() because it uses GTimeVal

GTimeVal is not year-2038-safe.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1438
This commit is contained in:
Philip Withnall 2019-06-18 12:35:41 +01:00
parent b8540db1bf
commit 626b6f5ea7
2 changed files with 9 additions and 1 deletions

View File

@ -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:

View File

@ -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