-
Notifications
You must be signed in to change notification settings - Fork 1
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
Efficiency of epoch time calculations #9
Comments
That is a very nice reference, thank you for linking it. I'm thinking that keeping zig-tzif would make more sense as part of a datetime library than as a separate component that a datetime library uses. Especially during testing, the need to manually convert dates into unix timestamps seems less than ideal. I would prefer it if the tests used ISO8601. I'll probably revive zig-chrono and copy the code from zig-tzif into it. I also wouldn't mind contributing to |
Yes, that is a good point. A time zone library makes much more sense in combination with a datetime library. That's why I came here in the first place. As for |
zig-tzif/tzif.zig
Line 538 in 3cc489a
addressing your comment, I think to make this more efficient, we could use days as base period, then add / subtract seconds where needed.
What I'm referring to here is Howard Hinnant's "date" algorithms - C++ library, explanations. For example the calculation of a transition time
t
from a given MonthWeekDay rulemwd
andyear
could look likeunixdaysFromDate
takes a triple year-month-day and returns days since the Unix epoch (Howard just calls it "days_from_civil"). zig-port. I've tested the applicability with an older version of your code, so the field names are different than in the current version etc. but... you get the point ;-)The text was updated successfully, but these errors were encountered: