Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* Copyright 2015 The Native Client Authors. All rights reserved. | |
|
Sam Clegg
2015/07/28 16:25:57
nit: newline here
zhitingzhu
2015/07/28 16:39:23
Done.
| |
| 2 * Use of this source code is governed by a BSD-style license that can be | |
| 3 * found in the LICENSE file. | |
| 4 */ | |
| 5 /* pull from freebsd 10.1 ./contrib/ldns/compat/timegm.c */ | |
| 6 #include <stdio.h> | |
| 7 #include <stdlib.h> | |
| 8 #include <time.h> | |
| 9 | |
| 10 time_t | |
| 11 timegm (struct tm *tm) { | |
| 12 time_t ret; | |
| 13 char *tz; | |
| 14 | |
| 15 tz = getenv("TZ"); | |
| 16 putenv((char*)"TZ="); | |
| 17 tzset(); | |
| 18 ret = mktime(tm); | |
| 19 if (tz) { | |
| 20 char buf[256]; | |
| 21 snprintf(buf, sizeof(buf), "TZ=%s", tz); | |
| 22 putenv(tz); | |
| 23 } | |
| 24 else | |
| 25 putenv((char*)"TZ"); | |
| 26 tzset(); | |
| 27 return ret; | |
| 28 } | |
| OLD | NEW |