Hey,
Maybe try this liitle script :
# cat calculate.py
#!/usr/local/bin/python
import sys
import datetime
for inputLine in sys.stdin:
line = inputLine.split()
dateStart = [int(x) for x in line[1].split("/")] + [int(x) for x
in line[2].split(":")]
dateEnd = [int(x) for x in line[3].split("/")] + [int(x) for x
in line[4].split(":")]
dateTimeStart = datetime.datetime(2000 +
dateStart[2],dateStart[0],dateStart[1],dateStart[3],dateStart[4],dateStart[5])
dateTimeEnd = datetime.datetime(2000 +
dateEnd[2],dateEnd[0],dateEnd[1],dateEnd[3],dateEnd[4],dateEnd[5])
timedifference = dateTimeEnd - dateTimeStart
totalSeconds = timedifference.days * 86400 + timedifference.seconds
hours = totalSeconds // 3600
minutes = (totalSeconds - hours * 3600) // 60
seconds = totalSeconds % 60
print inputLine[:-1] + " | " + str(timedifference),
print "| seconds " + str(totalSeconds),
print "| hh:mm:ss " + "%02d:%02d:%02d" % (hours,minutes,seconds)
# mminfo -r "ssid,sscreate(25), sscomp(25)" | tail +2 | ./calculate.py
1628208649 03/06/06 19:23:05 03/06/06 19:25:09 | 0:02:04
| seconds 124 | hh:mm:ss 00:02:04
1745649039 03/06/06 19:21:03 03/06/06 19:30:56 | 0:09:53
| seconds 593 | hh:mm:ss 00:09:53
1544322702 03/06/06 19:25:18 03/06/06 19:26:27 | 0:01:09
| seconds 69 | hh:mm:ss 00:01:09
1795980674 03/06/06 19:20:50 03/06/06 19:20:50 | 0:00:00
| seconds 0 | hh:mm:ss 00:00:00
3943463243 03/06/06 19:02:51 03/06/06 19:02:58 | 0:00:07
| seconds 7 | hh:mm:ss 00:00:07
2869721547 03/06/06 19:04:59 03/06/06 19:06:59 | 0:02:00
| seconds 120 | hh:mm:ss 00:02:00
2383182549 03/06/06 19:09:25 03/06/06 19:11:17 | 0:01:52
| seconds 112 | hh:mm:ss 00:01:52
Regards,
Gerrit
Tim Verbois wrote:
Hello,
I want to determine the backup time of a saveset.
I can ask the start time and end time, but without writing a whole
script that calculates the time, I cannot determine the correct backuptime.
For example:
# mminfo -r "ssid,sscreate(25), sscomp(25)"
ssid ss created ss completed
2198482180 03/05/06 01:12:52 03/05/06 01:37:00
1158296367 03/05/06 01:39:11 03/05/06 01:39:57
...
I have to calculate here between column 2 and 3.
# mminfo -r "ssid,nsavetime(25), sscomp(25)"
ssid save time ss completed
2198482180 1141517572 03/05/06 01:37:00
1158296367 1141519150 03/05/06 01:39:57
...
Column 2 is very usefull, but why can't I get the same for column 3?
Then I can just do Col 3-Col 2 and I get my backuptime (in seconds).
Tim
To sign off this list, send email to listserv AT listserv.temple DOT edu and type
"signoff networker" in the
body of the email. Please write to networker-request AT listserv.temple DOT edu
if you have any problems
wit this list. You can access the archives at
http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER
To sign off this list, send email to listserv AT listserv.temple DOT edu and type
"signoff networker" in the
body of the email. Please write to networker-request AT listserv.temple DOT edu
if you have any problems
wit this list. You can access the archives at
http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER
|