Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: ports/glibc-compat/src/timegm.c

Issue 1260083004: Add needed functions to glibc-compat for pkg (Closed) Base URL: https://chromium.googlesource.com/external/naclports.git@master
Patch Set: fix wrong c++ lib Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ports/glibc-compat/src/test.cc ('k') | ports/glibc-compat/src/writev.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ports/glibc-compat/src/timegm.c
diff --git a/ports/glibc-compat/src/timegm.c b/ports/glibc-compat/src/timegm.c
new file mode 100644
index 0000000000000000000000000000000000000000..7d2d5421aecbbb68ffc40e901d3bb96ca816f850
--- /dev/null
+++ b/ports/glibc-compat/src/timegm.c
@@ -0,0 +1,29 @@
+/* Copyright 2015 The Native Client Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+/* pull from freebsd 10.1 ./contrib/ldns/compat/timegm.c */
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+time_t
+timegm (struct tm *tm) {
+ time_t ret;
+ char *tz;
+
+ tz = getenv("TZ");
+ putenv((char*)"TZ=");
+ tzset();
+ ret = mktime(tm);
+ if (tz) {
+ char buf[256];
+ snprintf(buf, sizeof(buf), "TZ=%s", tz);
+ putenv(tz);
+ }
+ else
+ putenv((char*)"TZ");
+ tzset();
+ return ret;
+}
« no previous file with comments | « ports/glibc-compat/src/test.cc ('k') | ports/glibc-compat/src/writev.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698