Hello there,
I need to be able to compare time on a process tree with system time,
and take action accordingly.
Here's how I get the time on the process tree:
>>> for line in os.popen("ps -ef", "r"):
... if "telnet" in line:
... print line.split()[4]
...
11:00:25
11:01:31
10:01:25
09:57:38
09:15:15
I can get the system time like this:
>>> print time.ctime(time.time()).split()[3]
11:02:58
What I want to do is establish if the time of the process is *later*
than the system date. For example, we might have a process with a
time of 11:15:00, when the system time is 10:00:00. In practice this
means that the process is from 11am yesterday.
Other than splitting the string up more and saying is 11 bigger than
10, how can I go about this?
Also, is my time getting method above ok? Or are there better / more
elegant / more pythonic ways?
S.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor