Refactor time interpretation code

 * create timevalToLocalTime() function, which converts a 'struct timeval'
   to a time string (based on the currently set time zone)