Alright, I give up...chalk this one up to experience...

Jeff jam at quark.emich.edu
Tue Nov 16 07:23:56 EST 1999


On Tue, Nov 16, 1999 at 11:56:28AM +0000, Endgamer wrote:
> Alright, I finally give up. I've been bashing at this bloody idea all
> week...maybe I'm incredibly stupid (probably), but I can't see why,
> when I run this as a script from Windows 95, it doesn't return the
> current date setting on my machine. Could somebody put me out of my
> misery? I promise I'll stop bothering you <g>.
> 
> -------------------------------------------------------
> 
> # Date setting program (chunk 1)
> import os
> 
> olddate=os.popen("date",'r')
> 
> olddate=readdate
> 
> print olddate
> 
> -------------------------------------------------------
> 

I'm pretty sure the issue of setting the date on a win32 machine has been
brought up before in this newsgroup, and I would strongly advise doing a
search on deja.com as well as python.org to see what other resources you can
find.

I would suggest, however, that if you want to *query* the current date and
time setting of the machine that you not use 'popen'.. try the 'time'
module instead:

[~] [7:56pm] [jam at toast-pts/2] % python
Python 1.5.2 (#1, Apr 18 1999, 16:03:16)  [GCC pgcc-2.91.60 19981201 (egcs-1.1.1  on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import time
>>> print time.ctime.__doc__
ctime(seconds) -> string

Convert a time in seconds since the Epoch to a string in local time.
This is equivalent to asctime(localtime(seconds)).
>>> print time.time.__doc__
time() -> floating point number

Return the current time in seconds since the Epoch.
Fractions of a second may be present if the system clock provides them.
>>> print time.ctime(time.time())
Tue Nov 16 07:23:04 1999

regards,
J
-- 
|| visit gfd <http://quark.emich.edu/>
|| psa member #293 <http://www.python.org/> 
|| New Image Systems & Services, Inc. <http://www.newimage.com/>




More information about the Python-list mailing list