I've been trying all night to come up with a script that will take a file that contains job completion times like this as input:
18:30
17:45
16:39
18:01
17:50
...
and figure the Average completion time. I've tried several things, and I just can't seem to get it to figure correctly. I'm sure there is an easy way to do this, as I would assume that I'm not the first person that would require info like this, but for now, it's beyond me.
Also, one potential problem that I haven't even tried to tackle yet is what happens when the jobs finishes at say, 23:40 one night, and then at 00:15 the next night. The method I've been trying to perfect will return something like 11:45 as the average (pretty much 12 hours off).
So if the job starts/started at exactly the same time every day whats stopping you from finding the avg of the above values? Just cut the first fields (use ':' as delimiter). Find the sum. Divide by 60 to find the total minutes. Add up second fields on each line delimited by ':'.
Add the aboves sums and divide my the number of lines to get the avg. Divide by 60 to get the avg time when your script should end.
Ah, that rings some bells with me.
I searched for my query before I posted the topic, and found several threads discussing how to figure the run time of a job.
Convert the time to seconds and subtract.
This should work for me too. Convert to minutes (HH*60+MM), add em all up, and divide by the # of values, then convert back to HH:MM.
However, that still will not work if a job finishes before midnight sometimes, and after midnight other times.
However, it is progress, and that is good.
I'll whip something up and post the code here to see if it can be improved upon, and to see if anyone has any ideas as to how to get around the midnight quandry.