Chat freely about anything...

User avatar
By letuandk
#72906 void configTime(int timezone, int daylightOffset_sec, const char* server1, const char* server2, const char* server3)


1 - why does this interface use timezone in seconds, rather than hours?
2 - s_daylightOffset_sec is set but never appears to be used. what is its purpose?
User avatar
By dragondaud
#72927
letuandk wrote:1 - why does this interface use timezone in seconds, rather than hours?
2 - s_daylightOffset_sec is set but never appears to be used. what is its purpose?


Timezone is probably in seconds because not all time zones are increments of an hour, and timestamps are in seconds, so its easy to keep everything in the same units, with no fractions.

daylightOffset is not used, and its only purpose is probably maintaining compatibility with systems that do use it, but I'm not 100% sure. There is work being done on better time handling, covered in the issue linked above.

I would say it is probably best practice to run the system clock on UTC, and make time zone adjustments only for display of local time as needed. That being said, I posted an example recently that demonstrates the use of configTime and figuring out the correct time zone automatically, from public IP address.