Puzzled with Time Server conversion problems?

Bill Eldridge bill at hk.rfa.org
Wed Oct 6 07:45:14 EDT 1999


Benjamin Schollnick wrote:
> Please note these clients are *NOT* finished, because I don't see
> anyway to set the
> date & time inside of PYTHON.  Anyone that can point out a way to
> change the computers
> clock via python, I'll appreciate it.

Something like:

if os.environ[OS]=='Linux':
	newtime= time.strptime(<some calculation>)
	os.system('/bin/date ' + newtime)
else if re.search('Windows',os.environ[OS]):
	newday= time.strptime('%M %D %Y', %<some calculation>)
	newtime= time.strptime('%H%m%s',<some other calculation>)
	os.system('date + ',newday)
	os.system('time + ',newtime)

You might try os.name as well.  Not as nice as an internal-to-Python
solution, but I don't know of another way.


--
Bill Eldridge
Radio Free Asia
bill at hk.rfa.org




More information about the Python-list mailing list