Issue #6323 has been reported by phasis68 (Heesob Park).

----------------------------------------
Bug #6323: Invalid result of Time#strftime %z
https://bugs.ruby-lang.org/issues/6323

Author: phasis68 (Heesob Park)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0dev (2012-04-18 trunk 35387) [i386-mswin32_100]


I guess Revision 35377 made a kind of typo.

C:\>irb
irb(main):001:0> t = Time.new(2012,1,1,1,1,1,'+00:55')
=> 2012-01-01 01:01:01 +0155
irb(main):002:0> t.strftime('%z')
=> "+0155"


Here is a patch

diff --git a/strftime.c b/strftime.c.new
index ea369de..9f72777 100644
--- a/strftime.c
+++ b/strftime.c.new
@@ -493,7 +493,7 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, rb_encodi
 				sign = +1;
 			}
 			i = snprintf(s, endp - s, (padding == ' ' ? "%+*ld" : "%+.*ld"),
-				     precision + 2, sign * (off / 360 + 1));
+				     precision + 2, sign * (off / 3600 + 1));
 			if (i < 0) goto err;
 			s += i - 1;
                         off = off % 3600; 



-- 
http://bugs.ruby-lang.org/