aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2011-12-07 17:35:18 +0100
committerBjörn-Egil Dahlberg <[email protected]>2011-12-08 14:12:04 +0100
commit5b51d7679230e0dff82bc7250ab59126742e283a (patch)
tree5490d66101969d7701bffee329fffd8b0f7a1b64
parentdc244a2b3a9be89700f3b15013ea1f41a4016347 (diff)
downloadotp-5b51d7679230e0dff82bc7250ab59126742e283a.tar.gz
otp-5b51d7679230e0dff82bc7250ab59126742e283a.tar.bz2
otp-5b51d7679230e0dff82bc7250ab59126742e283a.zip
Set BASEYEAR to 1902
-rw-r--r--erts/emulator/beam/erl_time_sup.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_time_sup.c b/erts/emulator/beam/erl_time_sup.c
index ab491036f2..ed906f210d 100644
--- a/erts/emulator/beam/erl_time_sup.c
+++ b/erts/emulator/beam/erl_time_sup.c
@@ -583,7 +583,9 @@ static const int mdays[14] = {0, 31, 28, 31, 30, 31, 30,
(((y) % 100) != 0)) || \
(((y) % 400) == 0))
-#define BASEYEAR 1601
+/* This is the earliest year we are sure to be able to handle
+ on all platforms w/o problems */
+#define BASEYEAR 1902
/* A more "clever" mktime
* return 1, if successful
@@ -629,8 +631,8 @@ static int erl_mktime(time_t *c, struct tm *tm) {
*/
static time_t gregday(Sint year, Sint month, Sint day)
{
- int long ndays = 0;
- int gyear, pyear, m;
+ Sint ndays = 0;
+ Sint gyear, pyear, m;
/* number of days in previous years */
gyear = year - 1600;
@@ -645,7 +647,7 @@ static time_t gregday(Sint year, Sint month, Sint day)
if (is_leap_year(year) && (month > 2))
ndays++;
ndays += day - 1;
- return ndays - 135140; /* 135140 = Jan 1, 1970 */
+ return (time_t) (ndays - 135140); /* 135140 = Jan 1, 1970 */
}
#define SECONDS_PER_MINUTE (60)