rubysl/rubysl-time — pull request #1 by felipec (2013-10-06 18:50:36+00:00)
Title: time: fix strptime '%s %z'

This format is used by Git to store commit dates, and it is a sensible
way to represent them in a simple manner.

It works correctly in C and perl, but in Ruby it returns the wrong date:

require 'time'
time = Time.strptime('1377283786 -0700', '%s %z')
time.strftime('%s %z')
=> 1377283786 -0500

The fix is simple and don't affect the normal usage of '%s'.

In addition, '%s' is meant to imply UTC, however:

Time.strptime('1377283786', '%s')
=> 2013-08-23 13:49:46 -0500

After this patch:

Time.strptime('1377283786', '%s')
=> 2013-08-23 18:49:46 +0000

Time.strptime('1377283786 -0700', '%s %z')
=> 2013-08-23 11:49:46 -0700

For more information, see bug:

https://bugs.ruby-lang.org/issues/7445

Signed-off-by: Felipe Contreras