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