From ef16649125a56893a9e32209b472b8fc58bf859a Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Sat, 7 Apr 2012 16:39:52 +0200 Subject: [PATCH] unify gmt offset to $r0ket::timediff --- tools/mesh/lib/r0ket.pm | 3 ++- tools/mesh/meshtrace.pl | 2 +- tools/mesh/rf | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/mesh/lib/r0ket.pm b/tools/mesh/lib/r0ket.pm index 013457f..802e511 100755 --- a/tools/mesh/lib/r0ket.pm +++ b/tools/mesh/lib/r0ket.pm @@ -14,6 +14,7 @@ use Time::HiRes; our $verbose=0; our $bridge; # Open device our $quiet=0; +our $timediff=60*60*2; ### Utility sub sprint{ @@ -154,7 +155,7 @@ sub nice_mesh{ $out->{string}.=sprintf " t=%s (%+4d) rel=%s beacon=%s", strftime("%Y-%m-%d %H:%M:%S",gmtime $out->{time}), - $out->{time}-(Time::HiRes::time+3600), + $out->{time}-(Time::HiRes::time+$timediff), $out->{release}, resolvebeacon($out->{beacon}); }elsif($type eq "i"){ diff --git a/tools/mesh/meshtrace.pl b/tools/mesh/meshtrace.pl index c30caa2..0b285e9 100755 --- a/tools/mesh/meshtrace.pl +++ b/tools/mesh/meshtrace.pl @@ -61,7 +61,7 @@ while(1){ $p->{generation}, $p->{release}, strftime("%Y-%m-%d %H:%M:%S",gmtime $p->{time}), - $p->{time}-(time+3600), + $p->{time}-(time+$r0ket::timediff), r0ket::getbeacon($p->{beacon}) ); $win->refresh; diff --git a/tools/mesh/rf b/tools/mesh/rf index 2f23e76..0411e67 100755 --- a/tools/mesh/rf +++ b/tools/mesh/rf @@ -186,7 +186,7 @@ if($cmd =~ /^r/){ if($scmd eq "t"){ $pkt.="T"; $pkt.=chr(shift); #gen - $pkt.=pack("N",scalar(time)+2*60*60); + $pkt.=pack("N",scalar(time)+$r0ket::timediff); $pkt.=pack("N",0); $pkt.=pack("N",0); @@ -197,7 +197,7 @@ if($cmd =~ /^r/){ }elsif($scmd eq "a"){ $pkt.="A"; $pkt.=chr(shift); #gen - $pkt.=pack("N",scalar(time)+1*60*60+ 300); + $pkt.=pack("N",scalar(time)+$r0ket::timediff+ 300); $pkt.= pack("C",shift||0); $pkt.= pack("C",0); @@ -212,7 +212,7 @@ if($cmd =~ /^r/){ }elsif($scmd eq "b"){ $pkt.="B"; $pkt.=chr(shift); #gen - $pkt.=pack("N",scalar(time)+1*60*60+ 600); + $pkt.=pack("N",scalar(time)+$r0ket::timediff+ 600); $pkt.= pack("C",shift||0); $pkt.= pack("C",0); @@ -227,7 +227,7 @@ if($cmd =~ /^r/){ }elsif($scmd eq "c"){ $pkt.="\x1"; $pkt.=chr(shift); #gen - $pkt.=pack("N",scalar(time)+1*60*60+ 600); + $pkt.=pack("N",scalar(time)+$r0ket::timediff+ 600); $pkt.= pack("C",shift||0); $pkt.= pack("C",0);