----- Original Message -----
From: Randy Lea
To: dave@...
Sent: Wednesday, October 03, 2001 3:36 PM
Subject: xmlrpc time, thanks for the info
Dave,
I have been using the NIST web server to set my sytem time, doing it the hard way dealing with HTML. After I read the blogged info on the time/xmlrpc, I just created this little 8 line program to set my Win32 box's time/date.
Thanks,
Randy Lea
+++++++++++++++++++++++++++++++++++++++++++++++++++
# time.py
# set the system date and time to that found on
# the xmlrpc.com server (win32 only)
# the xmlrpc.com server (win32 only)
# Import the xmlrpclib module into namespace
from xmlrpclib import *
from xmlrpclib import *
# import string and os modules
import string, os
import string, os
# Instantiate a new XML-RPC Server object
# pointed at the xmlrpc.com time server
server = Server("http://time.xmlrpc.com/RPC2")
# pointed at the xmlrpc.com time server
server = Server("http://time.xmlrpc.com/RPC2")
# get the time and date, convert it to a list
now = (string.split("%s" % server.currentTime.getCurrentTime()))[1]
now = (string.split("%s" % server.currentTime.getCurrentTime()))[1]
# create a command string with the correct values
dateCmd = "date %s-%s-%s" % (now[4:6],now[6:8],now[:4])
timeCmd = "time %s" % now[9:]
dateCmd = "date %s-%s-%s" % (now[4:6],now[6:8],now[:4])
timeCmd = "time %s" % now[9:]
# execute the win32 shell commands to set time and date
os.system(timeCmd)
os.system(dateCmd)
os.system(timeCmd)
os.system(dateCmd)
##print timeCmd
##print dateCmd
##print dateCmd