TimeClient win32api.setsystemtime
Dag Nummedal
nummedal at ed.ntnu.no
Sat Oct 16 15:48:43 EDT 1999
quickbbs at my-deja.com writes:
[...]
> 2) Even though the time.asctime (timetuple) reports the right
> time, the tuple when processed by SetSystemTime is off by
> 5 hours. It might be due to a setting somewhere in windows
> but can someone glance at this and make sure everything
> looks AOK?
[..]
> #
> timetuple = time.localtime(dt)
Use time.gmtime, not time.localtime.
> print "Time - ", time.asctime(timetuple)
>
> #
> #
> #
> if sys.platform == "win32":
> import win32api
> win32api.SetSystemTime (timetuple[0], timetuple[1], timetuple[6],
> timetuple[2], timetuple[3], timetuple[4], timetuple[5], 0)
>
Also SetSystemTime uses dayofweek with sunday as 0, while time module uses 0
as monday. Use: (timetuple[6]+1)%7
--
Dag Nummedal
More information about the Python-list
mailing list