Diff for /src/usr.sbin/timed/timed/measure.c between versions 1.2 and 1.3

version 1.2, 2003/06/17 04:30:03 version 1.3, 2004/03/13 21:08:38
Line 32 Line 32
  *   *
  * @(#)measure.c        8.1 (Berkeley) 6/6/93   * @(#)measure.c        8.1 (Berkeley) 6/6/93
  * $FreeBSD: src/usr.sbin/timed/timed/measure.c,v 1.6 1999/08/28 01:20:17 peter Exp $   * $FreeBSD: src/usr.sbin/timed/timed/measure.c,v 1.6 1999/08/28 01:20:17 peter Exp $
 * $DragonFly: src/usr.sbin/timed/timed/measure.c,v 1.1 2003/06/16 07:38:43 dillon Exp $ * $DragonFly$
  */   */
   
 #include "globals.h"  #include "globals.h"
Line 58  static n_short seqno = 0; Line 58  static n_short seqno = 0;
  * ICMP timestamp messages.   * ICMP timestamp messages.
  */   */
 int                                     /* status val defined in globals.h */  int                                     /* status val defined in globals.h */
measure(maxmsec, wmsec, hname, addr, print)measure(u_long maxmsec,                        /* wait this many msec at most */
        u_long maxmsec;                        /* wait this many msec at most */        u_long wmsec,                        /* msec to wait for an answer */
        u_long wmsec;                        /* msec to wait for an answer */        char *hname, struct sockaddr_in *addr,
        char *hname;        int print)                        /* print complaints on stderr */
        struct sockaddr_in *addr; 
        int print;                        /* print complaints on stderr */ 
 {  {
         int length;          int length;
         int measure_status;          int measure_status;
Line 75  measure(maxmsec, wmsec, hname, addr, pri Line 73  measure(maxmsec, wmsec, hname, addr, pri
         long min_idelta, min_odelta;          long min_idelta, min_odelta;
         struct timeval tdone, tcur, ttrans, twait, tout;          struct timeval tdone, tcur, ttrans, twait, tout;
         u_char packet[PACKET_IN], opacket[64];          u_char packet[PACKET_IN], opacket[64];
        register struct icmp *icp = (struct icmp *) packet;        struct icmp *icp = (struct icmp *)packet;
        register struct icmp *oicp = (struct icmp *) opacket;        struct icmp *oicp = (struct icmp *)opacket;
        struct ip *ip = (struct ip *) packet;        struct ip *ip = (struct ip *)packet;
   
         min_idelta = min_odelta = 0x7fffffff;          min_idelta = min_odelta = 0x7fffffff;
         measure_status = HOSTDOWN;          measure_status = HOSTDOWN;
Line 296  quit: Line 294  quit:
  * round a number of milliseconds into a struct timeval   * round a number of milliseconds into a struct timeval
  */   */
 void  void
mstotvround(res, x)mstotvround(struct timeval *res, long x)
        struct timeval *res; 
        long x; 
 {  {
   
 #ifndef sgi  #ifndef sgi
         if (x < 0)          if (x < 0)
                 x = -((-x + 3)/5);                  x = -((-x + 3)/5);
Line 316  mstotvround(res, x) Line 313  mstotvround(res, x)
 }  }
   
 void  void
timevaladd(tv1, tv2)timevaladd(struct timeval *tv1, struct timeval *tv2)
        struct timeval *tv1, *tv2; 
 {  {
   
         tv1->tv_sec += tv2->tv_sec;          tv1->tv_sec += tv2->tv_sec;
         tv1->tv_usec += tv2->tv_usec;          tv1->tv_usec += tv2->tv_usec;
         if (tv1->tv_usec >= 1000000) {          if (tv1->tv_usec >= 1000000) {
Line 332  timevaladd(tv1, tv2) Line 329  timevaladd(tv1, tv2)
 }  }
   
 void  void
timevalsub(res, tv1, tv2)timevalsub(struct timeval *res, struct timeval *tv1, struct timeval *tv2)
        struct timeval *res, *tv1, *tv2; 
 {  {
   
         res->tv_sec = tv1->tv_sec - tv2->tv_sec;          res->tv_sec = tv1->tv_sec - tv2->tv_sec;
         res->tv_usec = tv1->tv_usec - tv2->tv_usec;          res->tv_usec = tv1->tv_usec - tv2->tv_usec;
         if (res->tv_usec >= 1000000) {          if (res->tv_usec >= 1000000) {

Removed from v.1.2  
changed lines
  Added in v.1.3