Bugzilla – Attachment 113896 Details for
Bug 27059
Adding elapsed times/durations to updatedatabase would be nice.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27059: Add elapsed times to updatedatabase.pl
Bug-27059-Add-elapsed-times-to-updatedatabasepl.patch (text/plain), 2.98 KB, created by
Martin Renvoize (ashimema)
on 2020-11-20 15:34:46 UTC
(
hide
)
Description:
Bug 27059: Add elapsed times to updatedatabase.pl
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-11-20 15:34:46 UTC
Size:
2.98 KB
patch
obsolete
>From 6012dbf7ea9d9d1802ff4ecdbfe780b3365c3bf9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 19 Nov 2020 16:00:18 +0000 >Subject: [PATCH] Bug 27059: Add elapsed times to updatedatabase.pl > >This patch adds an elapsed time to the timestamp field for each update. > >Test plan >1/ Apply patch >2/ Run updatedatebase >3/ Note the addition of an elapsed time in the output >--- > installer/data/mysql/updatedatabase.pl | 30 +++++++++++++++++++++----- > 1 file changed, 25 insertions(+), 5 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index b524fad3a6..4a37b45fb0 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -23500,6 +23500,7 @@ sub SetVersion { > C4::Context::clear_syspref_cache(); # invalidate cached preferences > } > >+my $start_time = time; > sub NewVersion { > my ( $DBversion, $bug_number, $descriptions ) = @_; > >@@ -23509,27 +23510,46 @@ sub NewVersion { > $descriptions = [ $descriptions ]; > } > my $first = 1; >- my $time = POSIX::strftime("%H:%M:%S",localtime); >+ my ( $seconds, $time, $elapsed ) = get_timestrings(); > for my $description ( @$descriptions ) { > if ( @$descriptions > 1 ) { > if ( $first ) { > unless ( $bug_number ) { >- say sprintf "Upgrade to %s done [%s]: %s", $DBversion, $time, $description; >+ say sprintf "Upgrade to %s done [%s %s]: %s", $DBversion, $time, $elapsed, $description; > } else { >- say sprintf "Upgrade to %s done [%s]: Bug %5s - %s", $DBversion, $time, $bug_number, $description; >+ say sprintf "Upgrade to %s done [%s %s]: Bug %5s - %s", $DBversion, $time, $elapsed, $bug_number, $description; > } > } else { > say sprintf "\t\t\t\t\t\t - %s", $description; > } > } else { > unless ( $bug_number ) { >- say sprintf "Upgrade to %s done [%s]: %s", $DBversion, $time, $description; >+ say sprintf "Upgrade to %s done [%s %s]: %s", $DBversion, $time, $elapsed, $description; > } else { >- say sprintf "Upgrade to %s done [%s]: Bug %5s - %s", $DBversion, $time, $bug_number, $description; >+ say sprintf "Upgrade to %s done [%s %s]: Bug %5s - %s", $DBversion, $time, $elapsed, $bug_number, $description; > } > } > $first = 0; > } >+ $start_time = $seconds; >+} >+ >+sub get_timestrings { >+ use integer; >+ my $now = time; >+ my $elapsed = $now - $start_time; >+ local $_ = $elapsed; >+ my ( $d, $h, $m, $s ); >+ $s = $_ % 60; >+ $_ /= 60; >+ $m = $_ % 60; >+ $_ /= 60; >+ $h = $_; >+ >+ my $now_pretty = POSIX::strftime("%H:%M:%S",localtime($now)); >+ my $elapsed_pretty = sprintf "(%02dh:%02dm:%02ds)", $h, $m, $s; >+ >+ return ( $now, $now_pretty, $elapsed_pretty); > } > > =head2 CheckVersion >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27059
:
113826
| 113896