From: "felipec (Felipe Contreras)" Date: 2013-10-09T07:46:28+09:00 Subject: [ruby-core:57748] [ruby-trunk - Bug #7445] strptime('%s %z') doesn't work Issue #7445 has been updated by felipec (Felipe Contreras). =begin So let's recap the current situation. Time.strptime() has been fixed in Ruby Core, and Rubinious as fixed strptime() in both Time, and DateTime in rubysl. So we have this: === Ruby MRI puts Time.strptime('1 +0100', '%s %z').strftime('%s %z') => 1 +0100 === Rubinious puts Time.strptime('1 +0100', '%s %z').strftime('%s %z') => 1 +0100 puts DateTime.strptime('1 +0100', '%s %z').strftime('%s %z') => 1 +0100 === C #define _XOPEN_SOURCE #include #include int main(int argc, char *argv[]) { struct tm tm; char buf[0x100]; strptime("1 +0100", "%s %z", &tm); strftime(buf, sizeof(buf), "%s %z", &tm); printf("%s\n", buf); return 0; } => 1 +0100 === Perl use DateTime::Format::Strptime; my $format = DateTime::Format::Strptime->new( pattern => '%s %z', ); my $dt = $format->parse_datetime('1 +0100'); print $dt->strftime('%s %z'), "\n"; => 1 +0100 And you still maintain that this is desirable? puts DateTime.strptime('1 +0100', '%s %z').strftime('%s %z') => 1 +0000 Come on, just apply the patch. =end ---------------------------------------- Bug #7445: strptime('%s %z') doesn't work https://bugs.ruby-lang.org/issues/7445#change-42350 Author: felipec (Felipe Contreras) Status: Rejected Priority: Low Assignee: tadf (tadayoshi funaba) Category: lib Target version: Next Major ruby -v: ruby 1.9.3p327 Backport: See: ruby -e "require 'date'; p DateTime.strptime('0 +0100', '%s %z').strftime('%s %z')" The timezone is ignored. -- http://bugs.ruby-lang.org/