Skip to content

Instantly share code, notes, and snippets.

@ahorek
Created June 15, 2021 00:04
Show Gist options
  • Save ahorek/04bb40da47990973d6622e84e62a153e to your computer and use it in GitHub Desktop.
Save ahorek/04bb40da47990973d6622e84e62a153e to your computer and use it in GitHub Desktop.
set/export TZ=EST
test.rb
puts File.open('aaa.txt') {|f| f.mtime }
puts File.open('aaa.txt') {|f| f.mtime }.zone
puts File.open('aaa.txt') {|f| f.mtime }.utc_offset
puts Time.now.utc_offset
puts Time.at(0).utc_offset
ENV["TZ"] = "CET"
puts File.open('aaa.txt') {|f| f.mtime }
puts File.open('aaa.txt') {|f| f.mtime }.zone
puts File.open('aaa.txt') {|f| f.mtime }.utc_offset
puts Time.now.utc_offset
puts Time.at(0).utc_offset
linux
2021-06-14 17:53:10 -0500
EST
-18000
-18000
-18000
2021-06-15 00:53:10 +0200
CEST
7200
7200
3600
windows
cruby 2.7
2021-06-15 00:57:09 +0100
eri
3600
3600
0
2021-06-14 23:57:09 +0000
CET
0
0
0
without fix
2021-06-15 01:57:09 +0200
SELČ
7200
0
0
2021-06-15 01:57:09 +0200
SELČ
7200
7200
3600
with fix
2021-06-14 23:57:09 UTC
UTC
0
0
0
2021-06-15 01:57:09 +0200
CEST
7200
7200
3600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment