summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--lib/time.rb6
-rw-r--r--test/test_time.rb2
-rw-r--r--version.h6
4 files changed, 20 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index a0f5bea1b9..d7481d08e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Thu Oct 10 00:00:30 2013 Tanaka Akira <akr@fsij.org>
+
+ * lib/time.rb (Time.strptime): Time.strptime('0', '%s') returns local
+ time Time object as Ruby 2.0 and before.
+
+Thu Oct 10 00:00:30 2013 Tanaka Akira <akr@fsij.org>
+
+ * lib/time.rb (Time.strptime): Use :offset.
+ Patch by Felipe Contreras. [ruby-core:57694]
+
Wed Oct 9 23:32:37 2013 Koichi Sasada <ko1@atdot.net>
* gc.c (rb_gc_disable): do rest_sweep() before disable GC.
diff --git a/lib/time.rb b/lib/time.rb
index 977010087e..12c2b30e25 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -393,7 +393,11 @@ class Time
d = Date._strptime(date, format)
raise ArgumentError, "invalid strptime format - `#{format}'" unless d
if seconds = d[:seconds]
- Time.at(seconds)
+ if offset = d[:offset]
+ Time.at(seconds).localtime(offset)
+ else
+ Time.at(seconds)
+ end
else
year = d[:year]
year = yield(year) if year && block_given?
diff --git a/test/test_time.rb b/test/test_time.rb
index 0a4e8a70c3..582e60b8ae 100644
--- a/test/test_time.rb
+++ b/test/test_time.rb
@@ -400,6 +400,8 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
def test_strptime
assert_equal(Time.utc(2005, 8, 28, 06, 54, 20), Time.strptime("28/Aug/2005:06:54:20 +0000", "%d/%b/%Y:%T %z"))
assert_equal(Time.at(1).localtime, Time.strptime("1", "%s"))
+ assert_equal(false, Time.strptime('0', '%s').utc?)
+ assert_equal(3600, Time.strptime('0 +0100', '%s %z').utc_offset)
end
def test_nsec
diff --git a/version.h b/version.h
index b5971ff71e..33902be1ea 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2013-10-09"
-#define RUBY_PATCHLEVEL 327
+#define RUBY_RELEASE_DATE "2013-10-10"
+#define RUBY_PATCHLEVEL 328
#define RUBY_RELEASE_YEAR 2013
#define RUBY_RELEASE_MONTH 10
-#define RUBY_RELEASE_DAY 9
+#define RUBY_RELEASE_DAY 10
#include "ruby/version.h"