select: overhaul for time64
[musl.git] / src / time / timegm.c
blob4e5907d7f56027f960c088014d935fb9c3682ca1
1 #define _GNU_SOURCE
2 #include "time_impl.h"
3 #include <errno.h>
5 time_t timegm(struct tm *tm)
7 struct tm new;
8 long long t = __tm_to_secs(tm);
9 if (__secs_to_tm(t, &new) < 0) {
10 errno = EOVERFLOW;
11 return -1;
13 *tm = new;
14 tm->tm_isdst = 0;
15 tm->__tm_gmtoff = 0;
16 tm->__tm_zone = __utc;
17 return t;