Skip to content

Commit

Permalink
* time.c (rb_time_timespec_new): swap utc and localtime
Browse files Browse the repository at this point in the history
  to generate gmt flag by INT_MAX - gmtoff.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nurse committed Nov 10, 2015
1 parent d68c3ec commit 911b1c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
Tue Nov 10 14:34:09 2015 NARUSE, Yui <naruse@ruby-lang.org>

* 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@ruby-lang.org>

* hash.c (rb_hash_{le,lt,ge,gt}): new methods, Hash#<=, Hash#<,
Expand Down
8 changes: 4 additions & 4 deletions time.c
Expand Up @@ -2315,7 +2315,7 @@ rb_time_nano_new(time_t sec, long nsec)
/**
* 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)
Expand All @@ -2327,12 +2327,12 @@ rb_time_timespec_new(const struct timespec *ts, int offset)
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");
}
Expand Down

0 comments on commit 911b1c6

Please sign in to comment.