@@ -250,10 +250,10 @@ libc_hidden_proto (__gettimeofday64)
/* Compute the `struct tm' representation of T,
offset OFFSET seconds east of UTC,
and store year, yday, mon, mday, wday, hour, min, sec into *TP.
- Return nonzero if successful. */
-extern int __offtime (__time64_t __timer,
- long int __offset,
- struct tm *__tp) attribute_hidden;
+ Return TP if successful, a null pointer otherwise. */
+extern struct tm *__offtime (__time64_t __timer,
+ long int __offset,
+ struct tm *__tp) attribute_hidden;
extern char *__asctime_r (const struct tm *__tp, char *__buf)
attribute_hidden;
@@ -24,8 +24,8 @@
/* Compute the `struct tm' representation of T,
offset OFFSET seconds east of UTC,
and store year, yday, mon, mday, wday, hour, min, sec into *TP.
- Return nonzero if successful. */
-int
+ Return TP if successful, a null pointer otherwise. */
+struct tm *
__offtime (__time64_t t, long int offset, struct tm *tp)
{
__time64_t days, rem, y;
@@ -73,7 +73,7 @@ __offtime (__time64_t t, long int offset, struct tm *tp)
{
/* The year cannot be represented due to overflow. */
__set_errno (EOVERFLOW);
- return 0;
+ return NULL;
}
tp->tm_yday = days;
ip = __mon_yday[__isleap(y)];
@@ -82,5 +82,5 @@ __offtime (__time64_t t, long int offset, struct tm *tp)
days -= ip[y];
tp->tm_mon = y;
tp->tm_mday = days + 1;
- return 1;
+ return tp;
}
@@ -648,7 +648,7 @@ __tzfile_compute (__time64_t timer, int use_localtime,
/* Convert to broken down structure. If this fails do not
use the string. */
- if (__glibc_unlikely (! __offtime (timer, 0, tp)))
+ if (__glibc_unlikely (__offtime (timer, 0, tp) == NULL))
goto use_last;
/* Use the rules from the TZ string to compute the change. */
@@ -610,9 +610,8 @@ __tz_convert (__time64_t timer, int use_localtime, struct tm *tp)
&leap_extra_sec, tp);
else
{
- if (! __offtime (timer, 0, tp))
- tp = NULL;
- else if (use_localtime)
+ tp = __offtime (timer, 0, tp);
+ if (tp && use_localtime)
__tz_compute (timer, tp);
leap_correction = 0;
leap_extra_sec = false;
@@ -627,7 +626,7 @@ __tz_convert (__time64_t timer, int use_localtime, struct tm *tp)
tp->tm_gmtoff = 0L;
}
- if (__offtime (timer, tp->tm_gmtoff - leap_correction, tp))
+ if (__offtime (timer, tp->tm_gmtoff - leap_correction, tp) != NULL)
{
/* This assumes leap seconds can occur only when the local
time offset from UTC is a multiple of 60 seconds,