- Code: Select all
import time
import datetime
t=time.time()
timeDeltaToUTC= (int(time.mktime(datetime.datetime.utcfromtimestamp(t+10).timetuple()) -t)/100)*100
for Dallas this is right now: timeDeltaToUTC = 18000 .. that changes with Daylight savings and regular time ..
The raw difference is not 18,000 as expected but 17999.01 ... 17999.79 (*) Thats why we add 10 and set the seconds to 00 with /100*100
there is probably a more elegant way but I have not found one..
Karl
(*) the 17999.xx seconds varies by +-0.x every time I call it. Looks like it gets some info in "utcfromtimestamp" from the internet?