X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ftime%2Fgmtime_r.c;h=22aec2c2e2ef21b8a1beb5bcd84da5988b3b41de;hb=4f3d346bffdf9ed2b1803653643dc31242490944;hp=13a2548fd44b9427e0a3450fb9f6fc9842b1661e;hpb=400c5e5c8307a2ebe44ef1f203f5a15669f20347;p=musl diff --git a/src/time/gmtime_r.c b/src/time/gmtime_r.c index 13a2548f..22aec2c2 100644 --- a/src/time/gmtime_r.c +++ b/src/time/gmtime_r.c @@ -1,10 +1,16 @@ -#include +#include "time_impl.h" +#include -#include "__time.h" - -struct tm *gmtime_r(const time_t *restrict t, struct tm *restrict result) +struct tm *__gmtime_r(const time_t *restrict t, struct tm *restrict tm) { - __time_to_tm(*t, result); - result->tm_isdst = 0; - return result; + if (__secs_to_tm(*t, tm) < 0) { + errno = EOVERFLOW; + return 0; + } + tm->tm_isdst = 0; + tm->__tm_gmtoff = 0; + tm->__tm_zone = __utc; + return tm; } + +weak_alias(__gmtime_r, gmtime_r);