Time Counter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • snehavarg
    New Member
    • May 2010
    • 1

    Time Counter

    Can anyone tell the perl script that counts the time when we are online?
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    when he logs in, start counting the time with:
    Code:
    use Time::HiRes qw(gettimeofday tv_interval); #get better than 1 second resolution
    $startTime = [gettimeofday]; # starting time
    when he logs out, requests a new webpage, or whatever event you want to measure, count the time with:
    Code:
    $currentTime = [gettimeofday]; # current time
    print tv_interval($startTime, $currentTime ); # print elapsed time.

    Comment

    Working...