summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-14 21:05:00 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-14 21:05:00 +0000
commitb782aea75f5b9e8d49ef12b9f7fe3ef0dbf9fd51 (patch)
tree74ce8dda09c926c750c07a1ed73a51e05015d519 /time.c
parent874224888489924c3674b2f9a7c3f1caeac47400 (diff)
* time.c (guess_local_offset): use the UTC offset of an older date on
64bit time_t environment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/time.c b/time.c
index 10ec037373..0a32f4f1a5 100644
--- a/time.c
+++ b/time.c
@@ -1506,8 +1506,15 @@ guess_local_offset(struct vtm *vtm_utc, int *isdst_ret, const char **zone_ret)
zone = "UTC";
# if defined(NEGATIVE_TIME_T)
- /* 1901-12-13 20:45:52 UTC : The oldest time in 32-bit signed time_t. */
- if (localtime_with_gmtoff_zone((t = (time_t)0x80000000, &t), &tm, &gmtoff, &zone)) {
+# if SIZEOF_TIME_T <= 4
+ /* 1901-12-13 20:45:52 UTC : The oldest time in 32-bit signed time_t. */
+# define THE_TIME_OLD_ENOUGH ((time_t)0x80000000)
+# else
+ /* Since the Royal Greenwich Observatory was commissioned in 1675,
+ no timezone defined using GMT at 1600. */
+# define THE_TIME_OLD_ENOUGH ((time_t)(1600-1970)*366*24*60*60)
+# endif
+ if (localtime_with_gmtoff_zone((t = THE_TIME_OLD_ENOUGH, &t), &tm, &gmtoff, &zone)) {
off = LONG2FIX(gmtoff);
isdst = tm.tm_isdst;
}