private static function getScoreboardTimeLimitUnixTimestamp(Contests $contest, $showAllRuns = false) { if ($showAllRuns || ContestsDAO::hasFinished($contest) && $contest->getShowScoreboardAfter()) { // Show full scoreboard to admin users // or if the contest finished and the creator wants to show it at the end return null; } $start = strtotime($contest->getStartTime()); $finish = strtotime($contest->getFinishTime()); $percentage = (double) $contest->scoreboard / 100.0; $limit = $start + (int) (($finish - $start) * $percentage); return $limit; }