| 6 |
| 7 | #include <stdlib.h> |
| 8 | #include <time.h> |
| 9 |
| 10 | #if !defined (__GLIBC__) |
| 11 |
| 12 | extern "C" { |
| 13 | // Native Client has no timegm(). |
| 14 | time_t timegm(struct tm* tm) { |
| 15 | time_t ret; |
| 16 | char* tz; |
| 17 | tz = getenv("TZ"); |
| 18 | setenv("TZ", "", 1); |
| 19 | tzset(); |
| 20 | ret = mktime(tm); |
| 21 | if (tz) |
| 22 | setenv("TZ", tz, 1); |
| 23 | else |
| 24 | unsetenv("TZ"); |
| 25 | tzset(); |
| 26 | return ret; |
| 27 | } |
| 28 | } // extern "C" |
| 29 |
| 30 | #endif // !defined (__GLIBC__) |
| 31 |