Is there a module that can record when and for how long each user logs in for? (Drupal 7) I'm working on developing a website as part of an academic project that requires tracking individual user activity throughout a long period of time. We need to do the very minimum track when users log in and for how long (or until they timeout). I haven't been able to find a module that does this, except for Open Web Analytics which is breaking some of our pages. 

I'm not completely closed to the idea of rolling my own solution but I'd like to do it through a tested module if possible.
You are looking for User Visits Advanced module, It have the option to track the hours visited by the users.


  The User Visits Advanced module is a contribute module for the User
  Visits module. It is extremely useful for social networking sites who
  wish to provide their users with statistics about the number of times
  a the users profile page is being viewed and by which other users.
  
  This module comes with its own database table to store statistics per
  user profile (uid). At cron time, the data from the user_visits table
  is collected, aggregated and stored in the user_visits_adv table. It
  stores
  
  
  the total number of visits per uid
  the number of visits of the X past days per uid
  the most recent visitors uids of the past Y hours