xref: /aosp_15_r20/external/cronet/base/os_compat_nacl.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/os_compat_nacl.h"
6 
7 #include <stdlib.h>
8 #include <time.h>
9 
10 #if !defined (__GLIBC__)
11 
12 extern "C" {
13 // Native Client has no timegm().
timegm(struct tm * tm)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