summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-19 08:38:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-19 08:38:11 +0000
commitb8148f45947eee7461986536114949556f4eda40 (patch)
tree16ae7f6b7588cc228e0175fe26e4ce15be539c47 /time.c
parentc613f625b7c0c72771d74f86a1177e00290577df (diff)
2000-06-19
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@767 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 5c3dcae..9028b73 100644
--- a/time.c
+++ b/time.c
@@ -490,7 +490,7 @@ time_eql(time1, time2)
}
static VALUE
-time_gmt_p(time)
+time_utc_p(time)
VALUE time;
{
struct time_object *tobj;
@@ -536,6 +536,9 @@ time_localtime(time)
time_t t;
GetTimeval(time, tobj);
+ if (tobj->tm_got && !tobj->gmt) {
+ return time;
+ }
t = tobj->tv.tv_sec;
tm_tmp = localtime(&t);
tobj->tm = *tm_tmp;
@@ -553,6 +556,9 @@ time_gmtime(time)
time_t t;
GetTimeval(time, tobj);
+ if (tobj->tm_got && tobj->gmt) {
+ return time;
+ }
t = tobj->tv.tv_sec;
tm_tmp = gmtime(&t);
tobj->tm = *tm_tmp;
@@ -1077,7 +1083,8 @@ Init_Time()
rb_define_method(rb_cTime, "isdst", time_isdst, 0);
rb_define_method(rb_cTime, "zone", time_zone, 0);
- rb_define_method(rb_cTime, "gmt?", time_gmt_p, 0);
+ rb_define_method(rb_cTime, "utc?", time_utc_p, 0);
+ rb_define_method(rb_cTime, "gmt?", time_utc_p, 0);
rb_define_method(rb_cTime, "tv_sec", time_to_i, 0);
rb_define_method(rb_cTime, "tv_usec", time_usec, 0);