[Tutor] Time help
Lloyd Kvam
pythonTutor at venix.com
Mon May 31 12:07:06 EDT 2004
Your loop requires that you catch an EXACT match to your desired time.
On a system that does not round to the second, this is quite unlikely to
happen. You could round current, but I'd recommend changing the while
test to be:
while now > current
The loop will exit when current reaches or exceeds now.
On Mon, 2004-05-31 at 11:42, MBussell at aol.com wrote:
> I am playing with the Time Module, and was attempt to write a script
> which would tell me when a specific time was reached.
>
> I am using the integer number of seconds since the epoch. This is
> what I have:
>
> def test():
> now = 1086017720.0
> current = time.time()
> print current
> while now<>current:
> current = time.time()
> print current
> print "now is acheived!"
>
> The problem is the count continues past the specific time.
>
> Thanks,
> MB
>
> ______________________________________________________________________
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358
voice: 603-653-8139
fax: 801-459-9582
More information about the Tutor
mailing list