X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftime%2Ftimegm.c;h=e7a7939b3da2dfee380864357519be9a572d039e;hb=HEAD;hp=6d08917e449518bb00179d56d7e38e8a2e61a98d;hpb=23be72ae4534c13a7fd03f580934cc251ada619f;p=musl diff --git a/src/time/timegm.c b/src/time/timegm.c index 6d08917e..e7a7939b 100644 --- a/src/time/timegm.c +++ b/src/time/timegm.c @@ -1,9 +1,18 @@ #define _GNU_SOURCE -#include - -#include "__time.h" +#include "time_impl.h" +#include time_t timegm(struct tm *tm) { - return __tm_to_time(tm); + struct tm new; + long long t = __tm_to_secs(tm); + if (__secs_to_tm(t, &new) < 0) { + errno = EOVERFLOW; + return -1; + } + *tm = new; + tm->tm_isdst = 0; + tm->__tm_gmtoff = 0; + tm->__tm_zone = "GMT"; + return t; }