I'm working on a rather complicated project that relies on some parts working in UTC and some in local time, incorporating DST. To make it worse, it has to calculate daily sunrise and sunset times and find the time zone as well - based only on latitude and longitude! It uses an ESP32 processor so giving you code won't help but the general principle I use is this:
1. keep the RTC running in UTC (= GMT) all the time
2. keep a software clock running in parallel to the RTC and periodically set it to the RTC to keep them in sync.
3. calculate a seconds value based on (Hours * 3600)+(Minutes * 60)+Seconds. Expand this to days, months and years as necessary.
3. Add to the seconds value (TZ hour difference * 3600).
4. Add to that (DST hours difference * 3600).
5. Convert the final value back to the time again to get the adjusted TZ + DST time. If using date as well, add that to the calculation.
It isn't as difficult as it seems and it will cater for different DST shifts and both full hour and half hour time zone differences.
In my application I have to cater for some events being triggered by UTC and some by DST so I recalculate as above every second and keep two time structures updated, using whichever is appropriate for the particular event. You can automatically calculate DST start and end dates if you can find the rules for your country. In the UK it is the last Sunday in March and the the last Sunday in October, both at 01:00 UTC.
Brian.