summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-10-30 12:50:34 -0400
committerJoey Hess <joeyh@joeyh.name>2017-10-30 12:50:34 -0400
commitb6a010d759c53befdc9755760d28b6647d50f8b0 (patch)
treec9c3a146438ff137365001225197bc2070a2eccf
parent12845e32adcaa18b83cd8f3f01fddf9189c7ebda (diff)
downloadmoreutils-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-xts29
1 files changed, 6 insertions, 23 deletions
diff --git a/ts b/ts
index 7134ea7..63baf18 100755
--- a/ts
+++ b/ts
@@ -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);
}
}