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

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