How to correctly use timezones

Sure. I have a simple little anvil application that allows me to enter upcoming important dates. This works great and was really easy to build.

For the display side, I have a microcontroller driving a e-ink display. This microcontroller doesn’t have a RTC and doesn’t know the time. But it can be configured with its time zone.

So to save processing power on the microcontroller and to increase flexibility, I do the display and date formatting server side. To this end the server needs to know the timezone information for the client. This information is needed to be able to make determinations of wether a given date is in the past, is today or tomorrow.

Right now I am using hard coded timezone offsets, but I would like to be able to use a library like pytz, so I can just specify the timezone and have the library handle the daylight savings time and offset.

This would be accomplished by passing a tzinfo to date aware Python methods.

How this all works is the IOT device makes a REST call to the server with the text description of the timezone (US/Eastern). The server return back the next 10 events. Notating which ones are the present day, the next day and the number of seconds to midnight all according to the timezone that was passed in.