]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Moved time dependent code out of the offset calculations.
authorLinux Karlsson <karlsson@ntp.org>
Tue, 3 Aug 2010 21:44:21 +0000 (23:44 +0200)
committerLinux Karlsson <karlsson@ntp.org>
Tue, 3 Aug 2010 21:44:21 +0000 (23:44 +0200)
bk: 4c588db5jFCJ8zXSffMuUF3ynnWNkQ

sntp/main.c

index 90e9cc947aaa34870560adcb159847a83b9e3445..e5517f4729474d851fbb78afe521bc1a75093981 100644 (file)
@@ -225,6 +225,9 @@ handle_pkt (
                        printf("sntp handle_pkt: Received %i bytes from %s\n", rpktl, addr_buf);
                }
 
+               GETTIMEOFDAY(&tv_dst, (struct timezone *)NULL);
+               tv_dst.tv_sec += JAN_1970;
+
                offset_calculation(rpkt, rpktl, &tv_dst, &offset, &precision, &root_dispersion);
 
                for (digits = 0; (precision *= 10.) < 1.; ++digits)
@@ -301,8 +304,6 @@ offset_calculation (
 #endif
 
        /* Compute offset etc. */
-       GETTIMEOFDAY(tv_dst, (struct timezone *)NULL);
-       tv_dst->tv_sec += JAN_1970;
        tmp = p_rec;
        L_SUB(&tmp, &p_org);
        LFPTOD(&tmp, t21);