X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ftime%2Fgmtime_r.c;h=fee01bd6ee866434df7c9efe13e21f1fd99572a2;hb=77830507bed92a62ab230b499d5b38ae45d208a4;hp=13a2548fd44b9427e0a3450fb9f6fc9842b1661e;hpb=400c5e5c8307a2ebe44ef1f203f5a15669f20347;p=musl diff --git a/src/time/gmtime_r.c b/src/time/gmtime_r.c index 13a2548f..fee01bd6 100644 --- a/src/time/gmtime_r.c +++ b/src/time/gmtime_r.c @@ -1,10 +1,17 @@ -#include +#include "time_impl.h" +#include +#include "libc.h" -#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 = "GMT"; + return tm; } + +weak_alias(__gmtime_r, gmtime_r);