summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-10 05:36:47 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-10 05:36:47 +0000
commit911b1c6b06a89603dfc9976a021b85e505221b7b (patch)
tree27ca5d040b0be392bff367569a1a8621f431b0d8 /time.c
parentd68c3ecf98bf3b5802a6b0f9a6bcf7825addd9e5 (diff)
* time.c (rb_time_timespec_new): swap utc and localtime
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
Diffstat (limited to 'time.c')
-rw-r--r--time.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/time.c b/time.c
index aad4cb4ad1..603fe8bf63 100644
--- a/time.c
+++ b/time.c
@@ -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)
@@ -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");
}