-
Notifications
You must be signed in to change notification settings - Fork 93
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
Timezone not applying to makeTime #10
Comments
|
But that isn't the way time_t values are supposed to work. At any given point in time, the time_t value returned to the application is same value in EVERY timezone on the planet. It has to work this way to be able to do timestamping and to be able to easily convert individual time_t values to local datetimes and broken down values. I wrote about this some more in this Arduino thread: I'll soon be creating another issue about time_t values not being handled properly and a recommendation with more details of how to fix it.
Once this is done, there is no longer a need to specify UTC vs LOCAL since proper Unix time_t values are always from the Unix Epoch and all functions will be using/returning time_t values from the same single epoch. For most users, correcting the code to use proper Unix time_t values will be completely transparent. |
I guess when I wrote this I wanted to make it a replacement for Arduino Time library that didn't have timezones, and I didn't want to break code that uses makeTime() and breakTime() by producing unexpected answers to code that isn't timezone-aware. But I see your point. I've reopened the issue, and as soon as I get some time to sit down with ezTime (early March?), I'll probably implement it the way you suggest. Might come back to you to bounce ideas back and forth at that time, if I may. |
Sounds good. Look forward to working with you on this. I think it is possible to provide compatibility with existing TimeLib sketch code and use proper time_t values by having both ezt and TimeZone makeTime() and breakTime(). What will be difficult will be to maintain compatibility with the current ezTime API behavior. But if that is important, it is probably possible with some additional constructor parameters that set flags/states/modes in the Timezone object. |
Is this expected behavior? I'm sure I'm doing something silly but If I set up a time_t element it prints without timezone adjustment.
The default timezone works, deconstructing t shows the hour as 21 and the epoch time is correct.
The text was updated successfully, but these errors were encountered: