Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POSIX-TZ and last transition time #17

Open
yorickhardy opened this issue Mar 15, 2023 · 3 comments
Open

POSIX-TZ and last transition time #17

yorickhardy opened this issue Mar 15, 2023 · 3 comments

Comments

@yorickhardy
Copy link

I tried the following code fragment:

local luatz = require("luatz")

local sydney_ts = luatz.time_in("Australia/Sydney")
sydney = luatz.timetable.new_from_timestamp(sydney_ts)

print(sydney)
print(os.date("!%c", sydney_ts))
os.execute("env TZ=Australia/Sydney date")

and the output:

2023-03-15T15:58:08.000
Wed Mar 15 15:58:08 2023
Wed Mar 15 16:58:08 AEDT 2023

differs by an hour. Looking through the code, it seems like the TZ entry is not used "in handling instants after the last transition time stored in the file" as per the documentation for the Version 2 tzfile format:

Linux tzfile.5
NetBSD tzfile.5

I am not sure that I have read everything correctly though.

@daurnimator
Copy link
Owner

Works for me:

luatz = require("luatz")

sydney_ts = luatz.time_in("Australia/Sydney")
sydney = luatz.timetable.new_from_timestamp(sydney_ts)

print(sydney)
print(os.date("!%c", math.floor(sydney_ts)))
os.execute("env TZ=Australia/Sydney date")
$ lua 17.lua
2023-03-21T13:19:30.597
Tue Mar 21 13:19:30 2023
Tue 21 Mar 2023 13:19:30 AEDT

Are you able to attach your tzfile?

@yorickhardy
Copy link
Author

yorickhardy commented Mar 21, 2023 via email

@yorickhardy
Copy link
Author

Oops, github does not seem to like the attachment. Let me try again (in a zip file).
sydney.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants