View | Details | Raw Unified | Return to bug 27048
Collapse All | Expand All

(-)a/misc/migration_tools/rebuild_zebra.pl (-19 / +12 lines)
Lines 18-23 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Koha::Script;
20
use Koha::Script;
21
use Koha::DateUtils;
22
use DateTime::Format::Duration;
21
use C4::Context;
23
use C4::Context;
22
use Getopt::Long;
24
use Getopt::Long;
23
use Fcntl qw(:flock);
25
use Fcntl qw(:flock);
Lines 209-217 if( !defined $LockFH ) { Link Here
209
                    # the lockfile)
211
                    # the lockfile)
210
};
212
};
211
213
212
my $start_time = time();
214
my $start_time = dt_from_string;
213
if ( $verbose_logging ) {
215
if ( $verbose_logging ) {
214
    my $pretty_time = POSIX::strftime("%H:%M:%S",localtime($start_time));
216
    my $pretty_time = dt_from_string()->strftime("%H:%M:%S");
215
    print "Zebra configuration information\n";
217
    print "Zebra configuration information\n";
216
    print "================================\n";
218
    print "================================\n";
217
    print "Zebra biblio directory      = $biblioserverdir\n";
219
    print "Zebra biblio directory      = $biblioserverdir\n";
Lines 833-854 sub _create_lockfile { #returns undef on failure Link Here
833
835
834
sub pretty_time {
836
sub pretty_time {
835
    use integer;
837
    use integer;
836
    my $now = time;
838
    my $now = dt_from_string;
837
    my $elapsed = $now - $start_time;
839
    my $elapsed = $now->delta_ms($start_time);
838
    local $_ = $elapsed;
840
    my $duration_formatter = DateTime::Format::Duration->new(pattern => '%e:%H:%M:%S');
839
    my ( $d, $h, $m, $s );
841
840
    $s = $_ % 60;
842
    my $now_pretty = $now->strftime("%H:%M:%S");
841
    $_ /= 60;
843
    #my $elapsed_pretty = $d ? "[$d:$h:$m:$s]" : $h ? "[$h:$m:$s]" : $m ? "[$m:$s]" : "[$s]";
842
    $m = $_ % 60;
844
843
    $_ /= 60;
845
    return "$now_pretty [" . $duration_formatter->format_duration($elapsed) . "]";
844
    $h = $_ % 24;
845
    $_ /= 24;
846
    $d = $_;
847
848
    my $now_pretty = POSIX::strftime("%H:%M:%S",localtime($now));
849
    my $elapsed_pretty = $d ? "[$d:$h:$m:$s]" : $h ? "[$h:$m:$s]" : $m ? "[$m:$s]" : "[$s]";
850
851
    return "$now_pretty $elapsed_pretty";
852
}
846
}
853
847
854
sub print_usage {
848
sub print_usage {
855
- 

Return to bug 27048