Discussion:
Make alpha 2038-safe
Michael McConville
2016-02-17 17:05:22 UTC
Permalink
Now that we have 64-bit time. Otherwise, all the people running Alpha in
2038 will yell at us.


Index: sys/arch/alpha/alpha/clock.c
===================================================================
RCS file: /cvs/src/sys/arch/alpha/alpha/clock.c,v
retrieving revision 1.21
diff -u -p -r1.21 clock.c
--- sys/arch/alpha/alpha/clock.c 23 Mar 2012 15:51:25 -0000 1.21
+++ sys/arch/alpha/alpha/clock.c 17 Feb 2016 16:59:22 -0000
@@ -212,9 +212,8 @@ inittodr(time_t base)
year = 1900 + UNIX_YEAR_OFFSET + ct.year;
if (year < 1970)
year += 100;
- /* simple sanity checks (2037 = time_t overflow) */
- if (year < MINYEAR || year > 2037 ||
- ct.mon < 1 || ct.mon > 12 || ct.day < 1 ||
+ /* simple sanity checks */
+ if (year < MINYEAR || ct.mon < 1 || ct.mon > 12 || ct.day < 1 ||
ct.day > 31 || ct.hour > 23 || ct.min > 59 || ct.sec > 59) {
/*
* Believe the time in the file system for lack of
Michael McConville
2016-02-17 18:33:42 UTC
Permalink
Post by Michael McConville
Now that we have 64-bit time. Otherwise, all the people running Alpha in
2038 will yell at us.
And sh:


Index: arch/sh/sh/clock.c
===================================================================
RCS file: /cvs/src/sys/arch/sh/sh/clock.c,v
retrieving revision 1.7
diff -u -p -r1.7 clock.c
--- arch/sh/sh/clock.c 8 Sep 2012 22:01:25 -0000 1.7
+++ arch/sh/sh/clock.c 17 Feb 2016 18:32:44 -0000
@@ -309,7 +309,7 @@ inittodr(time_t base)

if (!(sh_clock.flags & SH_CLOCK_NOINITTODR) &&
(rtc < base ||
- dt.dt_year < MINYEAR || dt.dt_year > 2037 ||
+ dt.dt_year < MINYEAR ||
dt.dt_mon < 1 || dt.dt_mon > 12 ||
dt.dt_wday > 6 ||
dt.dt_day < 1 || dt.dt_day > 31 ||
Philipp Schafft
2016-02-17 17:18:44 UTC
Permalink
flum,
Post by Michael McConville
Now that we have 64-bit time. Otherwise, all the people running Alpha in
2038 will yell at us.
Index: sys/arch/alpha/alpha/clock.c
===================================================================
RCS file: /cvs/src/sys/arch/alpha/alpha/clock.c,v
retrieving revision 1.21
diff -u -p -r1.21 clock.c
--- sys/arch/alpha/alpha/clock.c 23 Mar 2012 15:51:25 -0000 1.21
+++ sys/arch/alpha/alpha/clock.c 17 Feb 2016 16:59:22 -0000
@@ -212,9 +212,8 @@ inittodr(time_t base)
[...]
+ if (year < MINYEAR || ct.mon < 1 || ct.mon > 12 || ct.day < 1 ||
ct.day > 31 || ct.hour > 23 || ct.min > 59 || ct.sec > 59) {
[...]
I'm not sure if this applies here as well. In some places sec == 60 is
used for leap seconds.

Thank you for your work.
--
Philipp.
(Rah of PH2)
Loading...