ruby-changes:40438
From: naruse <ko1@a...>
Date: Tue, 10 Nov 2015 14:37:01 +0900 (JST)
Subject: [ruby-changes:40438] naruse:r52519 (trunk): * time.c (rb_time_timespec_new): swap utc and localtime
naruse 2015-11-10 14:36:47 +0900 (Tue, 10 Nov 2015) New Revision: 52519 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52519 Log: * time.c (rb_time_timespec_new): swap utc and localtime to generate gmt flag by INT_MAX - gmtoff. Modified files: trunk/ChangeLog trunk/time.c Index: time.c =================================================================== --- time.c (revision 52518) +++ time.c (revision 52519) @@ -2315,7 +2315,7 @@ rb_time_nano_new(time_t sec, long nsec) https://github.com/ruby/ruby/blob/trunk/time.c#L2315 /** * Returns a time object with UTC/localtime/fixed offset * - * offset is -86400 < fixoff < 86400 or INT_MAX (UTC) or INT_MAX-1 (localtime) + * offset is -86400 < fixoff < 86400 or INT_MAX (localtime) or INT_MAX-1 (utc) */ VALUE rb_time_timespec_new(const struct timespec *ts, int offset) @@ -2327,12 +2327,12 @@ rb_time_timespec_new(const struct timesp https://github.com/ruby/ruby/blob/trunk/time.c#L2327 GetTimeval(time, tobj); TIME_SET_FIXOFF(tobj, INT2FIX(offset)); } - else if (offset == INT_MAX) { /* UTC */ + else if (offset == INT_MAX) { /* localtime */ + } + else if (offset == INT_MAX-1) { /* UTC */ GetTimeval(time, tobj); TIME_SET_UTC(tobj); } - else if (offset == INT_MAX-1) { /* localtime */ - } else { rb_raise(rb_eArgError, "utc_offset out of range"); } Index: ChangeLog =================================================================== --- ChangeLog (revision 52518) +++ ChangeLog (revision 52519) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Nov 10 14:34:09 2015 NARUSE, Yui <naruse@r...> + + * time.c (rb_time_timespec_new): swap utc and localtime + to generate gmt flag by INT_MAX - gmtoff. + Tue Nov 10 14:01:59 2015 Nobuyoshi Nakada <nobu@r...> * hash.c (rb_hash_{le,lt,ge,gt}): new methods, Hash#<=, Hash#<, -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/