diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-10-30 12:50:34 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-10-30 12:50:34 -0400 |
commit | b6a010d759c53befdc9755760d28b6647d50f8b0 (patch) | |
tree | c9c3a146438ff137365001225197bc2070a2eccf | |
parent | 12845e32adcaa18b83cd8f3f01fddf9189c7ebda (diff) | |
download | moreutils-b6a010d759c53befdc9755760d28b6647d50f8b0.tar.gz |
Revert "ts: Introduce '-m' option to use CLOCK_MONOTONIC"
This reverts commit d4592ac408f2086a3ed305c3fccf9107763e2be4.
Seems he sent the wrong patch version
-rwxr-xr-x | ts | 29 |
1 files changed, 6 insertions, 23 deletions
@@ -56,9 +56,8 @@ $|=1; my $rel=0; my $inc=0; my $sincestart=0; -my $mono=0; use Getopt::Long; -GetOptions("r" => \$rel, "i" => \$inc, "s" => \$sincestart, "m" => \$mono) || die "usage: ts [-r] [-i | -s] [format]\n"; +GetOptions("r" => \$rel, "i" => \$inc, "s" => \$sincestart) || die "usage: ts [-r] [-i | -s] [format]\n"; if ($rel) { eval q{ @@ -78,22 +77,17 @@ $format=shift if @ARGV; # For subsecond resolution, Time::HiRes is needed. my $hires=0; -if ($format=~/\%\.[Ss]/ || $mono) { +if ($format=~/\%\.[Ss]/) { require Time::HiRes; - use Time::HiRes qw(CLOCK_MONOTONIC); $hires=1; } my $lastseconds = 0; my $lastmicroseconds = 0; -if ($mono) { - ($lastseconds, $lastmicroseconds) = - Time::HiRes::clock_gettime(CLOCK_MONOTONIC); -} elsif ($hires) { +if ($hires) { ($lastseconds, $lastmicroseconds) = Time::HiRes::gettimeofday(); -} -else { +} else { $lastseconds = time; } @@ -102,17 +96,7 @@ while (<>) { if (! $rel) { if ($hires) { my $f=$format; - my ($seconds, $microseconds); - if ($mono) { - my $raw_time = - Time::HiRes::clock_gettime(CLOCK_MONOTONIC); - $seconds = int($raw_time); - $microseconds = $raw_time - $seconds; - print "$raw_time $seconds $microseconds\n"; - } - else { - ($seconds, $microseconds) = Time::HiRes::gettimeofday(); - } + my ($seconds, $microseconds) = Time::HiRes::gettimeofday(); if ($inc || $sincestart) { my $deltaseconds = $seconds - $lastseconds; my $deltamicroseconds = $microseconds - $lastmicroseconds; @@ -139,8 +123,7 @@ while (<>) { $lastseconds = $seconds; } print strftime($format, localtime($deltaseconds)); - } - else { + } else { print strftime($format, localtime); } } |