Closed johnslemmer closed 4 years ago
Doesn't need localTime.setLocation("America/Los_Angeles");
to be beforelocalTime.setDefault();
?
I've noticed that putting this in setup, doesn't always work, even if Timezone is global, but in loop it does.
@underwoodblog
Doesn't need
localTime.setLocation("America/Los_Angeles");
to be beforelocalTime.setDefault();
?
No it doesn't. setDefault
just sets a certain Timezone
instance to the default. You can set/change the location as much as you want after that. At least that is the behavior I have seen in my testing.
I've noticed that putting this in setup, doesn't always work, even if Timezone is global, but in loop it does.
I have edited my original post to more clear about what is happening. But I haven't noticed any issue with how I'm doing it.
That does look like unexpected behaviour indeed. I just did a round of fixes, but let me look at this when I make some time for ezTime again. At that point I should be doing a larger overhaul to address larger structural issues as well, as the way I now deal with time_t in timezones is simply wrong. (It was an attempt to stay as close as possible to earlier arduino time libs, it turned into a bit of a mess.)
@johnslemmer thanks for the fix! @ropg I confirm the bug either, looking forward for the PR merging and new version release
results in the following output:
I believe this is a bug with
dateTime()
. The docs make it seem like these two calls todateTime
should be equivalent (unless I'm reading the docs incorrectly). TheCurrent time:
is correct for when I ran it. The problem seems to be that when atime_t
is given todateTime
it incorrectly translates it.