summaryrefslogtreecommitdiff
path: root/libc/time
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2008-06-20 09:26:44 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2008-06-20 09:26:44 +0000
commitff3e6f618d2dd1ec6887d2f3622f20889f876e1e (patch)
tree7bd685e3543aea58e3047c5ef60fa7a841ab0e73 /libc/time
parent96b85b5d0e370abaab4bf2d9129b6ad29d69e77a (diff)
Merge changes between r6192 and r6403 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@6404 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/time')
-rw-r--r--libc/time/strftime_l.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/libc/time/strftime_l.c b/libc/time/strftime_l.c
index eb8f06ce6..2f9668495 100644
--- a/libc/time/strftime_l.c
+++ b/libc/time/strftime_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2004, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -459,7 +459,8 @@ static CHAR_T const month_name[][10] =
#endif
static size_t __strftime_internal (CHAR_T *, size_t, const CHAR_T *,
- const struct tm *, bool ut_argument_spec_iso
+ const struct tm *, bool *
+ ut_argument_spec_iso
LOCALE_PARAM_PROTO) __THROW;
/* Write information from TP into S according to the format
@@ -485,7 +486,8 @@ my_strftime (s, maxsize, format, tp ut_argument LOCALE_PARAM)
tmcopy = *tp;
tp = &tmcopy;
#endif
- return __strftime_internal (s, maxsize, format, tp, false
+ bool tzset_called = false;
+ return __strftime_internal (s, maxsize, format, tp, &tzset_called
ut_argument LOCALE_ARG);
}
#ifdef _LIBC
@@ -499,7 +501,7 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
size_t maxsize;
const CHAR_T *format;
const struct tm *tp;
- bool tzset_called;
+ bool *tzset_called;
ut_argument_spec
LOCALE_PARAM_DECL
{
@@ -567,16 +569,6 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
if (! (zone && *zone))
zone = "GMT";
}
- else
- {
- /* POSIX.1 requires that local time zone information is used as
- though strftime called tzset. */
-# if HAVE_TZSET
- if (!tzset_called)
- tzset ();
- tzset_called = true;
-# endif
- }
#endif
if (hour12 > 12)
@@ -1329,7 +1321,18 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
#if HAVE_TZNAME
/* The tzset() call might have changed the value. */
if (!(zone && *zone) && tp->tm_isdst >= 0)
- zone = tzname[tp->tm_isdst];
+ {
+ /* POSIX.1 requires that local time zone information is used as
+ though strftime called tzset. */
+# if HAVE_TZSET
+ if (!*tzset_called)
+ {
+ tzset ();
+ *tzset_called = true;
+ }
+# endif
+ zone = tzname[tp->tm_isdst];
+ }
#endif
if (! zone)
zone = "";
@@ -1365,6 +1368,16 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
struct tm ltm;
time_t lt;
+ /* POSIX.1 requires that local time zone information is used as
+ though strftime called tzset. */
+# if HAVE_TZSET
+ if (!*tzset_called)
+ {
+ tzset ();
+ *tzset_called = true;
+ }
+# endif
+
ltm = *tp;
lt = mktime (&ltm);