views:

53

answers:

2

Hopefully a simple question, but I've been searching and searching with no luck:

In Python, is there a way to figure out what utc time offset the computer is set to?

+4  A: 

gmtime() will return the UTC time and localtime() will return the local time so subtracting the two should give you the utc offset.

jts
Brilliant! I need to learn to think simple :)
Paul
+2  A: 

time.timezone:

import time

print time.timezone

It prints UTC offset in seconds (to take into account Daylight Saving Time (DST) see time.altzone.

J.F. Sebastian