I'm doing some code where I need to known which time zone is active in the system (I'm working on a Linux SO):
My first aproach was to check
TZ
enviroment var,it's empty unless I set it (for instance calling tzset)After that I try
extern long timezone
(time.h) but this variable is always 0.Finally I calculate the difference of my timezone and UTC+0 but I don't get my real timezone because I don't known if daylight saving apply
I'm pretty sure that there are a easy (and most consistent) way to achieve this. I'm looking for something like "Europe/Paris" or "UTC+2" or something like that
Any help will be appreciated!