X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Ftime%2Fgmtime_r.c;h=0272870d6e46eb49019239bc8cd938aae7d40f93;hp=13a2548fd44b9427e0a3450fb9f6fc9842b1661e;hb=1cc81f5cb0df2b66a795ff0c26d7bbc4d16e13c6;hpb=f1292e3d28309bbc81f61671164843cec4319bfa diff --git a/src/time/gmtime_r.c b/src/time/gmtime_r.c index 13a2548f..0272870d 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 = EINVAL; + return 0; + } + tm->tm_isdst = 0; + tm->__tm_gmtoff = 0; + tm->__tm_zone = "GMT"; + return tm; } + +weak_alias(__gmtime_r, gmtime_r);