In Python, how do you find what UTC time offset the computer is set to?
gmtime()
will return the UTC time and localtime()
will return the local time so subtracting the two should give you the utc offset.
From https://pubs.opengroup.org/onlinepubs/009695399/functions/gmtime.html
The gmtime() function shall convert the time in seconds since the Epoch pointed to by timer into a broken-down time, expressed as Coordinated Universal Time (UTC).
So, despite the name gmttime
, the function returns UTC.