Problems? Is your data what you think it is? | |
PerlMonks |
Re: Re: Re: Funky date question.by CheeseLord (Deacon) |
on Jun 09, 2001 at 12:54 UTC ( [id://87165]=note: print w/replies, xml ) | Need Help?? |
Okay, I'll give this a shot; it appears you're looking for the logic, and not the code (which is good, because I'm not that good at Perl yet :). Anyway, here's my attempt at pseudocoding your problem:
Well, that came out a bit closer to code than I had intended... oh well. I hope that helps. Update: (1000 CDT 09 Jun) It occurred to me a bit more explanation might be in order. Basically, as I understand it, the key to your problem is to keep track of the first time you noticed the ID was in an open state, and only perform the addition to $totaltime when the ID moves out of the open state (and presumably, into one of the closed or hold states). Also, having watched a bit of the CB discussion on this topic, I noticed that you want to run this in realtime. If that's the case, you may want to generate a fake log entry to be processed at the end with the current time and a non-open state to force the calculation of the open time. This would change the code to be more like this:
Update #2: Edited code and above comments on real time about current state. I know it might not be the optimal method to do it, but it seems as if it should get the job done (if I understand the job to be done correctly). Try it out - if it doesn't work, let me know. If it does, let me know then, too - I never know when I might need this bit of code. :) CheeseLord
In Section
Seekers of Perl Wisdom
|
|