1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

UTC zone should be still "+00:00" [Feature #17544]

This commit is contained in:
Nobuyoshi Nakada 2021-02-16 19:28:28 +09:00
parent 9ef66ce3fc
commit 5b7439bb7b
Notes: git 2021-02-16 20:34:47 +09:00
2 changed files with 7 additions and 1 deletions

View file

@ -547,7 +547,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len,
else {
off = NUM2LONG(rb_funcall(vtm->utc_offset, rb_intern("round"), 0));
}
if (off < 0 || (off == 0 && (flags & BIT_OF(LEFT)))) {
if (off < 0 || (gmt && (flags & BIT_OF(LEFT)))) {
off = -off;
sign = -1;
}

View file

@ -925,6 +925,12 @@ class TestTime < Test::Unit::TestCase
assert_equal("-0000", t2000.strftime("%-z"))
assert_equal("-00:00", t2000.strftime("%-:z"))
assert_equal("-00:00:00", t2000.strftime("%-::z"))
t = t2000.getlocal("+00:00")
assert_equal("+0000", t.strftime("%z"))
assert_equal("+0000", t.strftime("%-z"))
assert_equal("+00:00", t.strftime("%-:z"))
assert_equal("+00:00:00", t.strftime("%-::z"))
end
def test_strftime_padding