diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php
index 0316715..98a11b8 100644
--- a/mod/quiz/report/overview/report.php
+++ b/mod/quiz/report/overview/report.php
@@ -486,7 +486,8 @@ class quiz_report extends quiz_default_report {
                         }
                         if ($attempt->timefinish) {
                             $timefinish = userdate($attempt->timefinish, $strtimeformat);
-                            $duration = format_time($attempt->duration);
+                            if ($attempt->duration < 0) $duration = '-';
+                            else $duration = format_time($attempt->duration);
                             if (!$download) {
                                 $row[] = '<a href="review.php?q='.$quiz->id.'&amp;attempt='.$attempt->attempt.'">'.$timefinish.'</a>';
                             } else {
diff --git a/mod/quiz/review.php b/mod/quiz/review.php
index bb24dad..c1dee92 100644
--- a/mod/quiz/review.php
+++ b/mod/quiz/review.php
@@ -174,7 +174,8 @@
     $overtime = 0;
 
     if ($attempt->timefinish) {
-        if ($timetaken = ($attempt->timefinish - $attempt->timestart)) {
+        if ($timetaken = ($attempt->timefinish - $attempt->timestart) &&
+            $attempt->timestart < $attempt->timefinish) {
             if($timelimit && $timetaken > ($timelimit + 60)) {
                 $overtime = $timetaken - $timelimit;
                 $overtime = format_time($overtime);
