Home | History | Annotate | Download | only in base
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      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().
     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