Ask Bjørn Hansen a écrit :
> On Nov 14, 2006, at 4:52 AM, Tim Shoppa wrote:
>> In fact I think it would be easier (one less function call to abs()
>> !) to track and plot the sign and magnitude of the offset rather than
>> just the magnitude.
> 
> Patches welcome.

Here you go. This is not tested, but it should be trivial enough.

Best,
GFK's
-- 
Guillaume Filion, ing. jr
Logidac Tech., Beaumont, Québec, Canada - http://logidac.com/
PGP Key and more: http://guillaume.filion.org/
Index: pool
===================================================================
--- pool        (revision 418)
+++ pool        (working copy)
@@ -333,15 +333,16 @@
             else {
                 my $recv_org   = $pkt{'Receive Timestamp'} - $time_now;
                 my $trans_dest = $pkt{'Transmit Timestamp'} - $time_then;
-                $offset = abs(($recv_org + $trans_dest) / 2);
-                if ($offset > 3 or $pkt{Stratum} > 5) {
+                $offset = ($recv_org + $trans_dest) / 2;
+                my $offset_abs = abs($offset);
+                if ($offset_abs > 3 or $pkt{Stratum} > 5) {
                     $step = -4;
                 }
-                elsif ($offset > 1.5) {
+                elsif ($offset_abs > 1.5) {
                     $step = -2;
                 }
-                elsif ($offset > 0.1) {
-                    $step = -2 * $offset + 1;
+                elsif ($offset_abs > 0.1) {
+                    $step = -2 * $offset_abs + 1;
                 }
                 else {
                     $step = 1;

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
timekeepers mailing list
[email protected]
https://fortytwo.ch/mailman/cgi-bin/listinfo/timekeepers

Reply via email to