summaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
Diffstat (limited to 'time')
-rw-r--r--time/Makefile25
-rw-r--r--time/mktime.c6
-rw-r--r--time/strptime.c36
3 files changed, 30 insertions, 37 deletions
diff --git a/time/Makefile b/time/Makefile
index cf0ac6a89d..1d8490cc8b 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -35,7 +35,7 @@ routines := offtime asctime clock ctime ctime_r difftime \
strptime
others := ap zdump zic
-tests := test_time clocktest
+tests := test_time clocktest test-tz
tzbases := africa antarctica asia australasia europe northamerica \
southamerica etcetera factory systemv \
@@ -54,15 +54,6 @@ all: # Make this the default target; it will be defined in Rules.
include ../Makeconfig # Get objpfx defined so we can use it below.
-ifeq (no,$(cross-compiling))
-# We can run the test-tz test only if we can install the test data using
-# zic. This isn't possible when cross-compiling.
-tests += test-tz
-
-# Before the test-tz test can be run we need the data to be installed.
-tests: install-test-data
-endif
-
# z.* use this variable.
define nl
@@ -71,7 +62,7 @@ endef
-include $(addprefix $(objpfx)z.,$(tzfiles))
# Make these absolute file names.
-installed-localtime-file := $(firstword $(filter /%,$(localtime-file)) \
+installed-localtime-file := $(firstword $(filter /%,$(inst_localtime-file)) \
$(addprefix $(inst_zonedir)/, \
$(localtime-file)))
installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \
@@ -178,17 +169,17 @@ CFLAGS-tzfile.c = $(tz-cflags)
CFLAGS-tzset.c = $(tz-cflags)
# We have to make sure the data for testing the tz functions is available.
-.PHONY: install-test-data
-install-test-data: $(addprefx $(objpfx)testdata/, America/New_York \
- Etc/UTC UTC)
+$(objpfx)test-tz.out: $(addprefix $(objpfx)testdata/, America/New_York \
+ Etc/UTC UTC)
-$(objpfx)testdata/America/New_York: $(objpfx)zic $(leapseconds) yearistype
+$(objpfx)testdata/America/New_York: northamerica $(objpfx)zic \
+ $(leapseconds) yearistype
$(built-program-cmd) -d $(objpfx)testdata -L $(leapseconds) \
-y yearistype northamerica
-$(objpfx)testdata/Etc/UTC: $(objpfx)zic $(leapseconds) yearistype
+$(objpfx)testdata/Etc/UTC: etcetera $(objpfx)zic $(leapseconds) yearistype
$(built-program-cmd) -d $(objpfx)testdata -L $(leapseconds) \
-y yearistype etcetera
-$(objpfx)testdata/UTC: $(objpfx)testdata/Etc/UTC $(objpfx)zic \
+$(objpfx)testdata/UTC: simplebackw $(objpfx)zic $(objpfx)testdata/Etc/UTC \
$(leapseconds) yearistype
$(built-program-cmd) -d $(objpfx)testdata -L $(leapseconds) \
-y yearistype simplebackw
diff --git a/time/mktime.c b/time/mktime.c
index d8fdf3a6c6..30438b5b10 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -74,8 +74,10 @@
#endif
#ifndef TIME_T_MIN
-#define TIME_T_MIN (0 < (time_t) -1 ? (time_t) 0 \
- : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))
+/* The outer cast to time_t works around a bug in Cray C 5.0.3.0. */
+#define TIME_T_MIN ((time_t) \
+ (0 < (time_t) -1 ? (time_t) 0 \
+ : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1)))
#endif
#ifndef TIME_T_MAX
#define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
diff --git a/time/strptime.c b/time/strptime.c
index 3340b4317c..89cfa8e2a4 100644
--- a/time/strptime.c
+++ b/time/strptime.c
@@ -129,7 +129,7 @@ localtime_r (t, tp)
#endif
#define recursive(new_fmt) \
(*(new_fmt) != '\0' \
- && strptime_internal (rp, (new_fmt), tm, decided) != NULL)
+ && (rp = strptime_internal (rp, (new_fmt), tm, decided)) != NULL)
#ifdef _LIBC
@@ -239,27 +239,27 @@ strptime_internal (buf, format, tm, decided)
#ifdef _NL_CURRENT
if (*decided !=raw)
{
- if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), rp))
+ if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp))
{
if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt),
- ab_weekday_name[cnt]))
+ && strcmp (_NL_CURRENT (LC_TIME, DAY_1 + cnt),
+ weekday_name[cnt]))
*decided = loc;
break;
}
- if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp))
+ if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), rp))
{
if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, DAY_1 + cnt),
- weekday_name[cnt]))
+ && strcmp (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt),
+ ab_weekday_name[cnt]))
*decided = loc;
break;
}
}
#endif
if (*decided != loc
- && (match_string (ab_weekday_name[cnt], rp)
- || match_string (weekday_name[cnt], rp)))
+ && (match_string (weekday_name[cnt], rp)
+ || match_string (ab_weekday_name[cnt], rp)))
{
*decided = raw;
break;
@@ -279,26 +279,26 @@ strptime_internal (buf, format, tm, decided)
#ifdef _NL_CURRENT
if (*decided !=raw)
{
- if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), rp))
+ if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp))
{
if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, ABMON_1 + cnt),
- ab_month_name[cnt]))
+ && strcmp (_NL_CURRENT (LC_TIME, MON_1 + cnt),
+ month_name[cnt]))
*decided = loc;
break;
}
- if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp))
+ if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), rp))
{
if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, MON_1 + cnt),
- month_name[cnt]))
+ && strcmp (_NL_CURRENT (LC_TIME, ABMON_1 + cnt),
+ ab_month_name[cnt]))
*decided = loc;
break;
}
}
#endif
- if (match_string (ab_month_name[cnt], rp)
- || match_string (month_name[cnt], rp))
+ if (match_string (month_name[cnt], rp)
+ || match_string (ab_month_name[cnt], rp))
{
*decided = raw;
break;
@@ -542,7 +542,7 @@ strptime_internal (buf, format, tm, decided)
case 'Y':
/* Match year including century number. */
get_number (0, INT_MAX);
- tm->tm_year = val - (val >= 2000 ? 2000 : 1900);
+ tm->tm_year = val - 1900;
break;
case 'Z':
/* XXX How to handle this? */