in reply to Comparing timestamps

You should start by reading the output of "perldoc -f time":
time Returns the number of non-leap seconds since what­ ever time the system considers to be the epoch (that's 00:00:00, January 1, 1904 for Mac OS, and 00:00:00 UTC, January 1, 1970 for most other sys­ tems). Suitable for feeding to "gmtime" and "localtime". For measuring time in better granularity than one second, you may use either the Time::HiRes module from CPAN, or if you have gettimeofday(2), you may be able to use the "syscall" interface of Perl, see perlfaq8 for details.
So, based on this info, you probably want to kill a session when the difference between its start time and the current time is greater than (2*60*60), which is the number of seconds in two hours.