I am writing some data collection software (in python) that will transmit data to the cloud. I am including a timestamp (using the standard datetime module included with python) in the data record so that the time is documented in the cloud datastore. It will run on an embedded linux device.
I am between a few architectural ideas for how to handle the timezone of the devices and the accuracy of the timestamps.
My thoughts are that I will use an NTP server to obtain the UTC time for the linux distribution which will provide an accurate time for all the applications running on the device. However I am unsure what I should set the timezone to on the device itself.
My concern is that if I set the timezone to the local time and it happens to be wrong, then not only will the local time be wrong, but when my application gets the UTC time from system time it will also be incorrect, even though it was negotiated previously by the NTP server. The timezone may be set incorrectly by whomever installs the deivce. I could mitigate this by including a GPS module in the device which can negotiate the GPS time to configure the system time, but this seems like extra hardware that would be unnecessary.
The other idea would be to have all devices timezone set to UTC and not change based on the location of the device. Then I can be sure that the UTC timestamps I send to the cloud are accurate, but I lose information about the local time unless I also send location info to the cloud database.
I'm not sure if there is a preferred method for setting system time on IoT devices such as this, but I would like some guidance.