code: private function timeSelector($attempt) {
  
          $retValue = time();
          if (!empty($attempt->timemodified)) {
              $retValue = $attempt->timemodified;
          } else if (!empty($attempt->timefinished)) {
              $retValue = $attempt->timefinished;
          } else if (!empty($attempt->timestarted)) {
              $retValue = $attempt->timestarted;
          }
  
          return $retValue;
      }
docs: Checks to see which time element in $attempt is valid and if none are available
  returns time()
  @param $attempt
  @return int