Skip to content

Commit f65e40d

Browse files
meisterTvmcj
authored andcommitted
Handle timediff's with missing start time.
Fixes #3147 This could happen in race conditions when picking up judgings, or when upgrading from previous DOMjudge versions.
1 parent a20c5ff commit f65e40d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

webapp/src/Twig/TwigExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function getGlobals(): array
185185
];
186186
}
187187

188-
public function printtimediff(float $start, ?float $end = null): string
188+
public function printtimediff(?float $start, ?float $end = null): string
189189
{
190190
return Utils::printtimediff($start, $end);
191191
}

webapp/src/Utils/Utils.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,11 @@ public static function printtime(string|float|null $datetime, string $format): s
546546
*
547547
* Copied from lib/www/print.php
548548
*/
549-
public static function printtimediff(float $start, ?float $end = null): string
549+
public static function printtimediff(?float $start, ?float $end = null): string
550550
{
551+
if (is_null($start)) {
552+
return '-';
553+
}
551554
if (is_null($end)) {
552555
$end = microtime(true);
553556
}

0 commit comments

Comments
 (0)