Is there a module that can record when and for how long each user logs in for? (Drupal 7)
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