Skip to content
This repository was archived by the owner on Sep 23, 2023. It is now read-only.

Commit d65a252

Browse files
edg2sMatmaRex
authored andcommitted
Show durations in minutes and seconds
1 parent c174876 commit d65a252

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

includes.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ function format_linked_tasks( array $linkedTasks ): string {
288288
return $linkedTasks ?: '<em>No tasks</em>';
289289
}
290290

291+
function format_duration( int $time ): string {
292+
return $time > 60 ?
293+
floor( $time / 60 ) . 'm' . ( $time % 60 ) . 's' :
294+
$time . 's';
295+
}
296+
291297
function shell_echo( string $cmd, array $env = [] ): int {
292298
echo '<pre>';
293299

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@
348348
'<td data-label="Linked tasks" class="linkedTasks">' . $linkedTasks . '</td>' .
349349
'<td data-label="Time" class="date">' . date( 'Y-m-d H:i:s', $wikiData[ 'created' ] ) . '</td>' .
350350
( $useOAuth ? '<td data-label="Creator">' . ( $creator ? user_link( $creator ) : '?' ) . '</td>' : '' ) .
351-
( $canAdmin ? '<td data-label="Time to create">' . ( $wikiData['timeToCreate'] ? $wikiData['timeToCreate'] . 's' : '' ) . '</td>' : '' ) .
351+
( $canAdmin ? '<td data-label="Time to create">' . ( $wikiData['timeToCreate'] ? format_duration( $wikiData['timeToCreate'] ) : '' ) . '</td>' : '' ) .
352352
( count( $actions ) ?
353353
'<td data-label="Actions">' . implode( '&nbsp;&middot;&nbsp;', $actions ) . '</td>' :
354354
'<!-- EMPTY ACTIONS -->'

new.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,6 @@ static function ( string $repo ) use ( $repos ): bool {
576576
$timeToCreate = time() - $startTime;
577577
wiki_set_time_to_create( $wiki, $timeToCreate );
578578

579-
set_progress( 100, 'All done! Wiki created in ' . $timeToCreate . 's.' );
579+
set_progress( 100, 'All done! Wiki created in ' . format_duration( $timeToCreate ) . '.' );
580580

581581
echo '</div>';

0 commit comments

Comments
 (0)