summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-02-16 21:35:48 +0000
committerJim Meyering <jim@meyering.net>1999-02-16 21:35:48 +0000
commita4758241e7c951348a30d88f3e2e4d568f493abe (patch)
treee2fa21951a304bcbf0506acc58463610b5f833e1 /lib
parent4762e4204278de7b0f25513d4d0a2dd7aefca4bc (diff)
downloadcoreutils-a4758241e7c951348a30d88f3e2e4d568f493abe.tar.xz
new version from Uli
Diffstat (limited to 'lib')
-rw-r--r--lib/mktime.c72
1 files changed, 31 insertions, 41 deletions
diff --git a/lib/mktime.c b/lib/mktime.c
index 1feb4046b..e18159e3b 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -1,24 +1,22 @@
/* mktime: convert a `struct tm' to a time_t value
- Copyright (C) 1993-1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1993, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
Contributed by Paul Eggert (eggert@twinsun.com).
- NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
+ The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/* Define this to have a standalone program to test this implementation of
mktime. */
@@ -109,14 +107,6 @@ const unsigned short int __mon_yday[2][13] =
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
};
-static struct tm *ranged_convert __P ((struct tm *(*) __P ((const time_t *,
- struct tm *)),
- time_t *, struct tm *));
-static time_t ydhms_tm_diff __P ((int, int, int, int, int, const struct tm *));
-time_t __mktime_internal __P ((struct tm *,
- struct tm *(*) (const time_t *, struct tm *),
- time_t *));
-
#ifdef _LIBC
# define my_mktime_localtime_r __localtime_r
@@ -124,7 +114,6 @@ time_t __mktime_internal __P ((struct tm *,
/* If we're a mktime substitute in a GNU program, then prefer
localtime to localtime_r, since many localtime_r implementations
are buggy. */
-static struct tm *my_mktime_localtime_r __P ((const time_t *, struct tm *));
static struct tm *
my_mktime_localtime_r (const time_t *t, struct tm *tp)
{
@@ -172,23 +161,6 @@ ydhms_tm_diff (int year, int yday, int hour, int min, int sec,
}
}
-
-static time_t localtime_offset;
-
-/* Convert *TP to a time_t value. */
-time_t
-mktime (struct tm *tp)
-{
-#ifdef _LIBC
- /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
- time zone names contained in the external variable `tzname' shall
- be set as if the tzset() function had been called. */
- __tzset ();
-#endif
-
- return __mktime_internal (tp, my_mktime_localtime_r, &localtime_offset);
-}
-
/* Use CONVERT to convert *T to a broken down time in *TP.
If *T is out of range for conversion, adjust it so that
it is the nearest in-range value and then convert that. */
@@ -389,6 +361,24 @@ __mktime_internal (struct tm *tp,
return t;
}
+
+static time_t localtime_offset;
+
+/* Convert *TP to a time_t value. */
+time_t
+mktime (tp)
+ struct tm *tp;
+{
+#ifdef _LIBC
+ /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
+ time zone names contained in the external variable `tzname' shall
+ be set as if the tzset() function had been called. */
+ __tzset ();
+#endif
+
+ return __mktime_internal (tp, my_mktime_localtime_r, &localtime_offset);
+}
+
#ifdef weak_alias
weak_alias (mktime, timelocal)
#endif