simple/ts/ts.pl

20 lines
426 B
Perl
Raw Permalink Normal View History

#!@@@perl@@@ -wT
2003-06-13 04:11:16 +02:00
use strict;
use POSIX;
use Time::HiRes qw(gettimeofday);
my $use_microseconds;
2003-08-26 19:46:33 +02:00
if (($ARGV[0] || "") eq '-u') {
$use_microseconds = 1;
shift;
}
2003-06-13 04:11:16 +02:00
while (<>) {
chomp;
my ($seconds, $microseconds) = gettimeofday;
my $now = strftime('%Y-%m-%dT%H:%M:%S', localtime($seconds));
if ($use_microseconds) {
printf "%s.%06d %s\n", $now, $microseconds, $_;
} else {
print "$now $_\n";
}
2003-06-13 04:11:16 +02:00
}