TZ affects the process in which it is set, and any children launched from that process. I interpreted that you wanted your script to use a "standard" timezone, while the rest of the system ran on local time.It only appear to change it temporarily.
To set the system timezone permanently, use timedatectl or raspi-config, as you know from a previous thread. Those require sudo, so you should not do them inside a program, but just once at installation time.
You can check whether DST is in use, but I do not think it is safe to assume that standard time is always one hour behind that, hence no good way to find the non-daylight offset. You would need to parse the actual tzdata files.(I don't know if python has a command to see if DST is in use)
But again, there is the time the local government says you should use, and there is the time according to the sun and stars, and there is the international reference time, UTC. I do not see the use for local-but-non-daylight-saving time.
Statistics: Posted by jojopi — Sat Dec 28, 2024 6:44 pm