[Tutor] Re: Setting the system time

Daniel Kinnaer Daniel.Kinnaer@Advalvas.be
Thu, 31 Jan 2002 22:59:44 +0100


Thanks for your replies.  Meanwhile, I'm only halfway
on how to set the systemtime.  That is, I've found how
to do this on a Windows-box (We use W2k at work).

if sys.platform == 'win32':
   import win32api
   win32api.SetSystemTime() #by Mark Hammond

I don't know how to go about when setting the
systemtime in a Linux environment.  Perhaps with the
date-command? Is this command the same for all major Linux
releases? 

I need this function in my NTP-client, as to synchronize
our Server with the main Server (abroad). I use a socket
for this purpose, get the ServerTime via port 37 and 
transform the given time into a tuple and use that tuple 
in the win32api.SetSystemTime().  This seems to work out very
nicely, as we're about <= 500ms off, which is acceptable...

Best regards,

Daniel