[Tutor] Re: Setting the system time

dman dsh8290@rit.edu
Thu, 31 Jan 2002 21:03:50 -0500

On Thu, Jan 31, 2002 at 10:59:44PM +0100, Daniel Kinnaer wrote:
| 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? 

Do you want to set the system clock, the hardware clock, or both?
'date' will set the system clock (on Solaris too) and 'hwclock' will
set the hardware clock (and can sync the two clocks).
| I need this function in my NTP-client,

Oh!  You want to make an NTP client.  Cool.  Your app will
definitely be run with root privileges then.

I suggest looking at the code for the 'date' and 'hwclock' programs as
they'll show you the programmatic interface for setting the time
(C-level interface).  Then it should be fairly straightforward for you
to make a python extension in C that provides a "set time" function.



Microsoft encrypts your Windows NT password when stored on a Windows CE
device. But if you look carefully at their encryption algorithm, they
simply XOR the password with "susageP", Pegasus spelled backwards.
Pegasus is the code name of Windows CE. This is so pathetic it's