[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Comparing dates



Hi.

I'm havin trouble finding some understandable information
on how to compare two dates.

What I want to accomplish:

>From a text log file I have extracted the minutes, hours, day, month and 
year
for to points in time. Now I want to know how much time has passed between
them.
In my first beta of the script in which I need this I just used this:

$time1 = $min1 + ( $hrs1 * 60 );
$time2 = $min2 + ( $hrs2 * 60 );
$connection_time = $time2 - $time1;

not very pretty of course, and it doesn't account for things like
23:55 to 01:05.
I guess I need a function that creates a timestamp from the parts I have,
and a function which calculates the minutes or hours of the intercal 
between
the two times.

Any help would be appreciated.

If you care, this is for a script that takes a log file from Apple Remote 
Access
and calculates the total time that the user has spent online.

Thanks,

Lasar

________________________________________________________
Lasar Liepins . lasar@liepins.de . http://www.liepins.de


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org