1 #define _GNU_SOURCE 2 #include "time_impl.h" 3 #include <errno.h> 4 5 extern const char __gmt[]; 6 timegm(struct tm * tm)7time_t timegm(struct tm *tm) 8 { 9 struct tm new; 10 long long t = __tm_to_secs(tm); 11 if (__secs_to_tm(t, &new) < 0) { 12 errno = EOVERFLOW; 13 return -1; 14 } 15 *tm = new; 16 tm->tm_isdst = 0; 17 tm->__tm_gmtoff = 0; 18 tm->__tm_zone = __gmt; 19 return t; 20 } 21