randomguy randomguy - 2 days ago 4
Ruby Question

Does Time.to_i always return number of seconds since EPOCH in UTC?

Is the timezone difference always ignored, regardless in which zone the time is expressed in?

Intuitively, the number of seconds passed since EPOCH should be higher for those who are, for example, in UTC+2. However, this seems not to be the case.

Answer

Epoch is based on the utc timezone https://en.wikipedia.org/wiki/Unix_time it does not depend of the timezone you're currently in.

Comments