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