summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-13 02:48:49 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-13 02:48:49 +0000
commit7aac416d2cb7b7393073fce6ca23c8006bd04ad4 (patch)
treec78a22ad09dc4f977f3e49b9572c55fc5a3e83ce
parent9f32fd3e9a0566e9258dda883e3ecf6f5474096d (diff)
subtle daylight bug
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--time.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/time.c b/time.c
index c47413525c..fd2c4a8368 100644
--- a/time.c
+++ b/time.c
@@ -272,7 +272,7 @@ static VALUE time_gmtime _((VALUE));
static VALUE time_localtime _((VALUE));
static VALUE time_get_tm _((VALUE, int));
-#if defined(HAVE_DAYLIGHT) && !defined __MINGW32__
+#if defined(HAVE_DAYLIGHT) && !defined(__MINGW32__)
extern int daylight;
extern long timezone;
#endif
@@ -317,9 +317,9 @@ make_time_t(tptr, utc_or_local)
if (guess < 0) goto out_of_range;
if (!utc_or_local) { /* localtime zone adjust */
-#if defined(HAVE_DAYLIGHT)
- localtime(&guess);
- guess += timezone + daylight;
+#if defined(HAVE_TM_ZONE)
+ tm = localtime(&guess);
+ guess += tm->tm_gmtoff;
#else
struct tm gt, lt;
long tzsec;
@@ -809,7 +809,9 @@ time_zone(time)
time_get_tm(time, tobj->gmt);
}
-#if defined HAVE_TZNAME && defined HAVE_DAYLIGHT
+#if defined(HAVE_TM_ZONE)
+ return rb_str_new2(tobj->tm.tm_zone);
+#elif defined(HAVE_TZNAME) && defined(HAVE_DAYLIGHT)
return rb_str_new2(tzname[daylight && tobj->tm.tm_isdst]);
#else
len = strftime(buf, 64, "%Z", &tobj->tm);