The solution depends on several things:
- discovering the time - from an external source or via manual entry (or from compiling... see below)
- discovering the time zone - often from the same external source (e.g. a PC or Mac knows the time and time zone)
- saving a timezone offset from GMT. I use 15-minute granularity... that's the smallest time zone offset I can find on earth.
- taking care to use ardor display the time in local or GMT time as appropriate
I re-looking right now for how to discover the time from the compiler/flasher. That's what I counted on in my Teensy3.2 code, and I've not re-found the magic incantation for Teensy 4.1
Please post what you discover, especially around using the time of compilation for setting the clock.
By the way, I'm using VS Code and PlatformIO as well.
Oh wait... I'm seeing you're asking about daily saving time.
I rely on an an external time sync for this (in my case, connection with a Mac, PC or iOS device) and resynch the time when I make such a connection, and allow the time to be off by an hour until that is done.
Since daylight time changes from year to year, and based on periodic changes to local legislation, an external service is likely to be required.