diff --git a/glib/gdatetime.c b/glib/gdatetime.c index a31afe713..429cadefc 100644 --- a/glib/gdatetime.c +++ b/glib/gdatetime.c @@ -893,8 +893,9 @@ static GDateTime * g_date_time_new_from_timeval (GTimeZone *tz, const GTimeVal *tv) { - if ((gint64) tv->tv_sec > G_MAXINT64 - 1 || - !UNIX_TO_INSTANT_IS_VALID ((gint64) tv->tv_sec + 1)) + gint64 tv_sec = tv->tv_sec; + + if (tv_sec > G_MAXINT64 - 1 || !UNIX_TO_INSTANT_IS_VALID (tv_sec + 1)) return NULL; return g_date_time_from_instant (tz, tv->tv_usec +