in reply to Re: Finding Time Difference of Localtime
in thread Finding Time Difference of Localtime
I just happened on to this and wonder if this is the behavior that Corion was expecting out of this. This isn't "my thread" or anything; I was just searching (again) for ways to time programs. I'm hoping to find a native one that works on Termux.
$ ./1.strftime.pl Argument "Sun Dec 1 00:29:42 2019" isn't numeric in subtraction (-) a +t ./1.strftime.pl line 9. Argument "Sun Dec 1 00:29:52 2019" isn't numeric in subtraction (-) a +t ./1.strftime.pl line 9. It took me 0 seconds Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1 +, yday = -1, isdst = -1) at ./1.strftime.pl line 11. $ cat 1.strftime.pl #!/usr/bin/perl use strict; use warnings; use POSIX qw(strftime); my $start = gmtime(); sleep 10; my $end = gmtime(); my $duration = $end - $start; print "It took me $duration seconds\n"; my $start_date = strftime "%Y-%m-%d %H:%M:%S", $start; my $end_date = strftime "%Y-%m-%d %H:%M:%S", $end; print "I was started on $start_date and ended on $end_date\n"; $
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Finding Time Difference of Localtime
by Corion (Patriarch) on Dec 01, 2019 at 08:01 UTC | |
by Aldebaran (Curate) on Dec 03, 2019 at 19:56 UTC |