OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / timegm.3
index 98a4004..2715e5d 100644 (file)
@@ -1,5 +1,6 @@
 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
@@ -19,8 +20,9 @@
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
-.TH TIMEGM 3 2007-07-26 "GNU" "Linux Programmer's Manual"
+.TH TIMEGM 3 2013-07-04 "GNU" "Linux Programmer's Manual"
 .SH NAME
 timegm, timelocal \- inverses of gmtime and localtime
 .SH SYNOPSIS
@@ -49,7 +51,7 @@ are the inverses of
 .BR localtime (3)
 and
 .BR gmtime (3).
-.SH "CONFORMING TO"
+.SH CONFORMING TO
 These functions are nonstandard GNU extensions
 that are also present on the BSDs.
 Avoid their use; see NOTES.
@@ -82,20 +84,32 @@ my_timegm(struct tm *tm)
     char *tz;
 
     tz = getenv("TZ");
+    if (tz)
+        tz = strdup(tz);
     setenv("TZ", "", 1);
     tzset();
     ret = mktime(tm);
-    if (tz)
+    if (tz) {
         setenv("TZ", tz, 1);
-    else
+        free(tz);
+    } else
         unsetenv("TZ");
     tzset();
     return ret;
 }
 .fi
 .in
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR gmtime (3),
 .BR localtime (3),
 .BR mktime (3),
 .BR tzset (3)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.