glib-mainloop: Drop deprecated g_get_current_time() usage

This uses the year 2038-safe g_get_real_time() as recommended instead.
Bumps GLib dependency to 2.28 as a result.
This commit is contained in:
Arun Raghavan 2020-07-23 19:36:11 -04:00 committed by Arun Raghavan
parent b546beef21
commit c442227c6b
3 changed files with 11 additions and 14 deletions

View file

@ -894,7 +894,7 @@ AC_ARG_ENABLE([glib2],
AS_HELP_STRING([--disable-glib2],[Disable optional GLib 2 support])) AS_HELP_STRING([--disable-glib2],[Disable optional GLib 2 support]))
AS_IF([test "x$enable_glib2" != "xno"], AS_IF([test "x$enable_glib2" != "xno"],
[PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ], HAVE_GLIB20=1, HAVE_GLIB20=0)], [PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.28.0 ], HAVE_GLIB20=1, HAVE_GLIB20=0)],
HAVE_GLIB20=0) HAVE_GLIB20=0)
AS_IF([test "x$enable_glib2" = "xyes" && test "x$HAVE_GLIB20" = "x0"], AS_IF([test "x$enable_glib2" = "xyes" && test "x$HAVE_GLIB20" = "x0"],

View file

@ -556,7 +556,7 @@ if gio_dep.found()
cdata.set('HAVE_GSETTINGS', 1) cdata.set('HAVE_GSETTINGS', 1)
endif endif
glib_dep = dependency('glib-2.0', version : '>= 2.4.0', required: get_option('glib')) glib_dep = dependency('glib-2.0', version : '>= 2.28.0', required: get_option('glib'))
if glib_dep.found() if glib_dep.found()
cdata.set('HAVE_GLIB', 1) cdata.set('HAVE_GLIB', 1)
endif endif

View file

@ -482,16 +482,15 @@ static gboolean prepare_func(GSource *source, gint *timeout) {
return TRUE; return TRUE;
} else if (g->n_enabled_time_events) { } else if (g->n_enabled_time_events) {
pa_time_event *t; pa_time_event *t;
GTimeVal now; gint64 now;
struct timeval tvnow; struct timeval tvnow;
pa_usec_t usec; pa_usec_t usec;
t = find_next_time_event(g); t = find_next_time_event(g);
g_assert(t); g_assert(t);
g_get_current_time(&now); now = g_get_real_time();
tvnow.tv_sec = now.tv_sec; pa_timeval_store(&tvnow, now);
tvnow.tv_usec = now.tv_usec;
if (pa_timeval_cmp(&t->timeval, &tvnow) <= 0) { if (pa_timeval_cmp(&t->timeval, &tvnow) <= 0) {
*timeout = 0; *timeout = 0;
@ -514,15 +513,14 @@ static gboolean check_func(GSource *source) {
return TRUE; return TRUE;
else if (g->n_enabled_time_events) { else if (g->n_enabled_time_events) {
pa_time_event *t; pa_time_event *t;
GTimeVal now; gint64 now;
struct timeval tvnow; struct timeval tvnow;
t = find_next_time_event(g); t = find_next_time_event(g);
g_assert(t); g_assert(t);
g_get_current_time(&now); now = g_get_real_time();
tvnow.tv_sec = now.tv_sec; pa_timeval_store(&tvnow, now);
tvnow.tv_usec = now.tv_usec;
if (pa_timeval_cmp(&t->timeval, &tvnow) <= 0) if (pa_timeval_cmp(&t->timeval, &tvnow) <= 0)
return TRUE; return TRUE;
@ -558,16 +556,15 @@ static gboolean dispatch_func(GSource *source, GSourceFunc callback, gpointer us
} }
if (g->n_enabled_time_events) { if (g->n_enabled_time_events) {
GTimeVal now; gint64 now;
struct timeval tvnow; struct timeval tvnow;
pa_time_event *t; pa_time_event *t;
t = find_next_time_event(g); t = find_next_time_event(g);
g_assert(t); g_assert(t);
g_get_current_time(&now); now = g_get_real_time();
tvnow.tv_sec = now.tv_sec; pa_timeval_store(&tvnow, now);
tvnow.tv_usec = now.tv_usec;
if (pa_timeval_cmp(&t->timeval, &tvnow) <= 0) { if (pa_timeval_cmp(&t->timeval, &tvnow) <= 0) {