blob: 58fe93e0cb15de5216516ada3e7e0fbf0fa84e06 [file] [log] [blame]
James Robinson646469d2014-10-03 15:33:28 -07001// 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
12extern "C" {
13// Native Client has no timegm().
14time_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__)