in reply to Re^3: Finding Time Difference of Localtime
in thread Finding Time Difference of Localtime
That gets us there:
$ ./2.strftime.pl It took me 10 seconds I was started on 2019-12-03 11:41:38 and ended on 2019-12-03 11:41:48 $ cat 2.strftime.pl
I'll fix the above post.#!/usr/bin/perl use strict; use warnings; use POSIX qw(strftime); my $start = time(); sleep 10; my $end = time(); my $duration = $end - $start; print "It took me $duration seconds\n"; my $start_date = strftime "%Y-%m-%d %H:%M:%S",(localtime($start)); my $end_date = strftime "%Y-%m-%d %H:%M:%S",(localtime($end)); print "I was started on $start_date and ended on $end_date\n";
Fixing a post from 2010 might have a butterfly effect. Getting better behavior from output is what happens with code review and replication in "the monastery."
|
|---|