A question about time
Jan Danielsson
jan.danielsson at gmail.com
Thu Jun 9 16:58:17 EDT 2005
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?
More information about the Python-list
mailing list