* time.c (time_add): propagate fixed time offset.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3360a65ba7
commit
795b03c71c
@ -1,3 +1,7 @@
|
|||||||
|
Mon Feb 15 22:18:49 2010 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* time.c (time_add): propagate fixed time offset.
|
||||||
|
|
||||||
Mon Feb 15 17:42:20 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
Mon Feb 15 17:42:20 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* signal.c (USE_SIGALTSTACK): NetBSD can't use sigaltstack(2)
|
* signal.c (USE_SIGALTSTACK): NetBSD can't use sigaltstack(2)
|
||||||
|
@ -27,6 +27,16 @@ class TestTime < Test::Unit::TestCase
|
|||||||
assert_equal(Time.utc(2000, 3, 21, 3, 30) + (-3 * 3600),
|
assert_equal(Time.utc(2000, 3, 21, 3, 30) + (-3 * 3600),
|
||||||
Time.utc(2000, 3, 21, 0, 30))
|
Time.utc(2000, 3, 21, 0, 30))
|
||||||
assert_equal(0, (Time.at(1.1) + 0.9).usec)
|
assert_equal(0, (Time.at(1.1) + 0.9).usec)
|
||||||
|
|
||||||
|
assert((Time.utc(2000, 4, 1) + 24).utc?)
|
||||||
|
assert(!(Time.local(2000, 4, 1) + 24).utc?)
|
||||||
|
|
||||||
|
t = Time.new(2000, 4, 1, 0, 0, 0, "+01:00") + 24
|
||||||
|
assert(!t.utc?)
|
||||||
|
assert_equal(3600, t.utc_offset)
|
||||||
|
t = Time.new(2000, 4, 1, 0, 0, 0, "+02:00") + 24
|
||||||
|
assert(!t.utc?)
|
||||||
|
assert_equal(7200, t.utc_offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_time_subt()
|
def test_time_subt()
|
||||||
|
5
time.c
5
time.c
@ -2909,6 +2909,11 @@ time_add(struct time_object *tobj, VALUE offset, int sign)
|
|||||||
GetTimeval(result, tobj);
|
GetTimeval(result, tobj);
|
||||||
TIME_SET_UTC(tobj);
|
TIME_SET_UTC(tobj);
|
||||||
}
|
}
|
||||||
|
else if (TIME_FIXOFF_P(tobj)) {
|
||||||
|
VALUE off = tobj->vtm.utc_offset;
|
||||||
|
GetTimeval(result, tobj);
|
||||||
|
TIME_SET_FIXOFF(tobj, off);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user