in reply to total time usage by day with last

Parse the strings, transform them into DateTime objects, create DateTime::Span objects from the usage times and then use the intersection() method on the usage times, passing them a span covering a particular weekday.

The data format is somewhat ambiguous, though: What does it look like if someone stays logged in for three days? Three years? Is it safe to assume the start/end dates are in the current year?

Replies are listed 'Best First'.
Re^2: total time usage by day with last
by CountZero (Bishop) on Apr 08, 2006 at 09:03 UTC
    That won't work at all. The only useful info is the date and the period of time between brackets. The other time-strings are utter nonsense: how could a terminal have been on between 06:00 and 03:00 on the same day? Did time run backwards?

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      06:00A.M. is logon time and 03:00P.M. logoff time for a total of 8:00hours, but the only useful info is the time between the brackets EX: (8:00). If user is still logged on the message still logged on is returned instead of a total time logged on in brackets. Thats easy enought to get rid of. The problem is when u have someone logged in for (07:42). it is Easy to add 8:00 + 8:00 but when u add 8:00 + 07:42 it doesnt return the correct number because i am dealing with time.

        That must be the first time that a computer does not use a 24 hr clock but uses AM and PM and doesn't even mentions it! And BTW if you log on at 6AM and log-off at 3Pm, you have logged-9 hours of computer-time.

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law