On Sep 18, 2009, at 23:04, Dan F. wrote:
Why is the time printed 6 hours apart but in unix time it is 7 hours
apart? Is it a DST issue?
To me, this seems like a bug in strftime. The only difference between
‘local’ and ‘utc’ should be in the default time zone shown.
Internally they’re both the same time. local.to_i and utc.to_i should
be the same number.
It seems to me that, from the description, Time#to_i and
Time#strftime("%s").to_i should be the same number, but they’re
My guess about what’s happening is that internally Ruby creates a
struct_tm object by using Time#to_a, which would be different for the
two different variables since it uses the display values for the
hours, minutes, seconds, etc. It then uses those fields in a call to
the underlying C strftime() call. Since the only time-zone related
field in a struct_tm is tm_isdst, the time-zone related info is mostly
I’d recommend that if you want the epoch time, just use Time#to_i and