thanks... works very well...
Hi,this library works only with RTC's?
Is there something like "Auto Daylight Savings Time" for ntp?
NTP sends UTC only, without adjustments for daylight time or time zone.
So the first sentence "A primary aim of this library is to allow a Real Time Clock (RTC)" did confuse me.
Bill, thanks for the feedback. Time stuff in general makes my head hurt! I only did a tiny bit of Unix and it was so long ago that it no longer counts. So for better or worse, it wasn't an influence when writing this library XDtracking time gets pretty simple once you leave the human form of time representation behindand buy into the epoch concept which is the only real way to tellwhen something actually happened since locality is removed from the equation.i.e. track time in a simpler form based on a epoch and then convert it to what humans like to seeonly when the human wants to know what time it is.epochs also make comparing date/times and calculating deltas trivialand allow you to compare times from different localities without having to knowthe localities.Consider how complicated things get when trying to figure out exactly how longago something happened, if someone tells you it occured at exactly at: YYYY-MM-DD-HH:MM:SSIn order to know how much time has passed, you have to know the two timezones.- yours, and his and then do lots of complicated math with many exceptions to get tothe elapsed time.This is why the arilines don't use local times to track time. They all use "ZULU" time whichis GMT. http://wwp.greenwichmeantime.com/info/zulu.htmOne thing I do wonder about is if humanity is ever wiped out, would future aliens go crazy trying to figure outthe significance of 1970-01-01-00:00 as much as we wonder about the significance ofthey mayan 2012-12-21 ?If I were to call localtime on a Unix machine, whose local time would I get? Whatever zone the machine was set for?Yes, but it can be overridden by the users TZ environment variable which gets pulled into in the current running process doing the locatltime() call.And the beauty of that is that it allows things like networking and remote processesto have known consistencies with time even when the machines are in different localitiesusing different timezones.BTW, Windows NT also uses epoch based time, but they chose a different epoch.(I was reading about localtime here, looks like a nice site, don't think I'd come across it before.)I'm more use to the C version as C++ was invented yet when I was doing lots of kernel work back in the early 80s'.
utc = now(); myTZ.localTime_r(&utc, &tm);
I tried library with GPS time and it works well until arduino power on and it is attached to the computer, when i power it off and on arduino after some time the bare arduino library does not sync with GPS, it starts where it stopped so i got two different times. GPS time works well but library time stayed behind as long power offed?On restart library should sync with GPS? but it is not doing?
The only real bummer is that Michael changed some of the tm elementsto be 1 based vs 0 based when he created his Arduino Time library.And that can't be change now without likely breaking lots of existing code.--- bill
Michael deviated from the unix time functions by changing some of the paramters from being zerobased to being one based. His tmElements_t wDay and Month are 1 based wherease the struct tm tm_wday and tm_monare zero based.