Bug #4221
closedUnexpected result of Time#strftime("%s") on Windows with trunk
Description
=begin
C:\work>irb
irb(main):001:0> Time.at(2000000000).strftime('%s')
=> "2000000000"
irb(main):002:0> Time.at(3000000000).strftime('%s')
=> "/.',').'"
irb(main):003:0> Time.at(4000000000).strftime('%s')
=> ".',').'"
irb(main):004:0> Time.at(5000000000).strftime('%s')
=> "705032704"
=end
Updated by pweldon (Peter Weldon) almost 14 years ago
=begin
Most likely an overflow bug:
irb(main):001:0> Time.at(231 - 1).strftime('%s')
=> "2147483647"
irb(main):002:0> Time.at(231).strftime('%s')
=> "./,),(-*,("
irb(main):003:0> Time.at(232).strftime('%s')
=> "0"
irb(main):004:0> Time.at(232 + 1).strftime('%s')
=> "1"
=end
Updated by pweldon (Peter Weldon) almost 14 years ago
=begin
From 8155b4d68f5b09ad95da23db499cd718be38fd29 Mon Sep 17 00:00:00 2001
From: Peter Weldon peter.weldon@null.net
Date: Wed, 29 Dec 2010 12:32:30 -0800
Subject: [PATCH] vsnprintf.c (BSD__uqtoa): Fix overflow when long != quad_t
vsnprintf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/vsnprintf.c b/vsnprintf.c
index 7576b4c..648904f 100644
--- a/vsnprintf.c
+++ b/vsnprintf.c
@@ -368,7 +368,7 @@ static char *
BSD__uqtoa(register u_quad_t val, char *endp, int base, int octzero, const char *xdigs)
{
register char *cp = endp;
-
register long sval;
-
register quad_t sval; /* * Handle the three cases separately, in the hope of getting
--
1.7.1.msysgit.0
=end
Updated by naruse (Yui NARUSE) almost 14 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r30435.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end