https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112010-12-30T04:34:20ZRuby Issue Tracking SystemRuby master - Bug #4221: Unexpected result of Time#strftime("%s") on Windows with trunkhttps://bugs.ruby-lang.org/issues/4221?journal_id=149612010-12-30T04:34:20Zpweldon (Peter Weldon)peter.weldon@null.net
<ul></ul><p>=begin<br>
Most likely an overflow bug:</p>
<p>irb(main):001:0> Time.at(2<strong>31 - 1).strftime('%s')<br>
=> "2147483647"<br>
irb(main):002:0> Time.at(2</strong>31).strftime('%s')<br>
=> "./,),(-*,("<br>
irb(main):003:0> Time.at(2<strong>32).strftime('%s')<br>
=> "0"<br>
irb(main):004:0> Time.at(2</strong>32 + 1).strftime('%s')<br>
=> "1"<br>
=end</p> Ruby master - Bug #4221: Unexpected result of Time#strftime("%s") on Windows with trunkhttps://bugs.ruby-lang.org/issues/4221?journal_id=149622010-12-30T05:34:34Zpweldon (Peter Weldon)peter.weldon@null.net
<ul></ul><p>=begin<br>
From 8155b4d68f5b09ad95da23db499cd718be38fd29 Mon Sep 17 00:00:00 2001<br>
From: Peter Weldon <a href="mailto:peter.weldon@null.net" class="email">peter.weldon@null.net</a><br>
Date: Wed, 29 Dec 2010 12:32:30 -0800<br>
Subject: [PATCH] vsnprintf.c (BSD__uqtoa): Fix overflow when long != quad_t</p>
<hr>
<p>vsnprintf.c | 2 +-<br>
1 files changed, 1 insertions(+), 1 deletions(-)</p>
<p>diff --git a/vsnprintf.c b/vsnprintf.c<br>
index 7576b4c..648904f 100644<br>
--- a/vsnprintf.c<br>
+++ b/vsnprintf.c<br>
@@ -368,7 +368,7 @@ static char *<br>
BSD__uqtoa(register u_quad_t val, char *endp, int base, int octzero, const char *xdigs)<br>
{<br>
register char *cp = endp;</p>
<ul>
<li>
<pre><code> register long sval;
</code></pre>
</li>
</ul>
<ul>
<li>
<pre><code> register quad_t sval;
/*
* Handle the three cases separately, in the hope of getting
</code></pre>
</li>
</ul>
<p>--<br>
1.7.1.msysgit.0<br>
=end</p> Ruby master - Bug #4221: Unexpected result of Time#strftime("%s") on Windows with trunkhttps://bugs.ruby-lang.org/issues/4221?journal_id=149652010-12-31T03:57:07Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>=begin<br>
This issue was solved with changeset r30435.<br>
Heesob, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<p>=end</p>