[packages/perl-Time-TAI64] add tai64nd tool, to print tai64nlocal + diff from last entry
glen
glen at pld-linux.org
Thu Aug 2 12:58:39 CEST 2012
commit 8b55c24c0476ad17d4520bf2aa556e3256c8df70
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Thu Aug 2 13:58:24 2012 +0300
add tai64nd tool, to print tai64nlocal + diff from last entry
perl-Time-TAI64.spec | 5 +++++
tai64nd.pl | 18 ++++++++++++++++++
2 files changed, 23 insertions(+)
---
diff --git a/perl-Time-TAI64.spec b/perl-Time-TAI64.spec
index 206203b..e8b1cef 100644
--- a/perl-Time-TAI64.spec
+++ b/perl-Time-TAI64.spec
@@ -13,6 +13,7 @@ License: GPL v1+ or Artistic
Group: Development/Languages/Perl
Source0: http://www.cpan.org/modules/by-module/Time/%{pdir}-%{pnam}-%{version}.tar.gz
# Source0-md5: 6f91734171a72b418bd70456fda487ce
+Source1: tai64nd.pl
URL: http://search.cpan.org/dist/Time-TAI64/
BuildRequires: perl-devel >= 1:5.8.0
BuildRequires: rpm-perlprov >= 4.1-13
@@ -40,11 +41,15 @@ rm -rf $RPM_BUILD_ROOT
%{__make} pure_install \
DESTDIR=$RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_sbindir}
+install -p %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/tai64nd
+
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%doc Changes README
+%attr(755,root,root) %{_sbindir}/tai64nd
%{perl_vendorlib}/Time/TAI64.pm
%{_mandir}/man3/Time::TAI64.3pm*
diff --git a/tai64nd.pl b/tai64nd.pl
new file mode 100755
index 0000000..5026213
--- /dev/null
+++ b/tai64nd.pl
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+# tai64nlocal + diff
+# tool that prints differences from last entry
+# Author: Elan Ruusamäe <glen at delfi.ee>
+# Date: 2012-08-02
+
+use strict;
+use warnings;
+use Time::TAI64 qw/:tai64n/;
+
+my ($last, $tai, $log, $t, $diff);
+while (my $line = <>) {
+ ($tai, $log) = split(' ', $line, 2);
+ $t = tai64nunix($tai);
+ $diff = $last ? $t - $last : 0;
+ printf "%s [+%.4f] %s", tai64nlocal($tai), $diff, $log;
+ $last = $t;
+}
More information about the pld-cvs-commit
mailing list