From: Jan Danielsson <[EMAIL PROTECTED]>
To: python-list@python.org
Subject: A question about time
Date: Thu, 09 Jun 2005 22:58:17 +0200
Hello all,
I have a list of servers which an application connects to. If the
connection fails, the application should mark the server as temporarily
unavailable, and should try to use the server again after x units of time.
In C, I would do this:
server.invalidUntil = time(NULL) + 5*60; // five minute delay
..and the check:
if(time(NULL) > server.invalidUtil)
{
// use server
}
So the whole thing very simple... But how do I do that in Python?
I have found datetime.datetime.now(), but I don't understand what
"format" it returns the time in. I assume it's an object of some sort..
But how do I do if I want the current time as an integer (unix
timestamp) in Python?
---
Heres the time module link, use a combination of the modules to get the
complete time. Use time.sleep() to sleep for a certain amount of SECONDS.
Not minutes. So:
from sleep import time
sleep(5)
would have the program or script stop and wait for 5 seconds. I hope this
was what your were asking for, I didn't quite get the question.
-Ivan
_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
--
http://mail.python.org/mailman/listinfo/python-list