simple/ts/ts.pl

20 lines
418 B
Perl
Raw 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;
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
}