Модернизация процесса измерений интервалов времени в операционных системах современных компьютеров - page 9

long)tv.tv_sec+tv.tv_usec)/(ntransmitted-1);
- - -
> int ipg = (1000000000*(long
long)tv.tv_sec+tv.tv_nsec)/(ntransmitted-1).
Далее представлен листинг модификации файла ping.c пакета
iputils.
# rcsdiff -r1.1 ping.c
================================================================
RCS file: ping.c,v
retrieving revision 1.1
diff -r1.1 ping.c
2c2
< * Copyright (c) 1989 The Regents of the University of California.
- - -
> * Copyright (c) 1989 The Regents of the University of California.
499c499
< if (datalen >= sizeof(struct timeval)) /* can we time transfer */
- - -
> if (datalen >= sizeof(struct timespec)) /* can we time transfer */
616c616
< * of the data portion are used to hold a UNIX "timeval" struct in VAX
- - -
> * of the data portion are used to hold a UNIX "timespec" struct in VAX
636,638c636,639
< static volatile int fake_fucked_egcs = sizeof(struct timeval);
< struct timeval tmp_tv;
< gettimeofday(&tmp_tv, NULL);
- - -
> static volatile int fake_fucked_egcs = sizeof(struct timespec);
> struct timespec tmp_tv;
> // gettimeofday(&tmp_tv, NULL);
> clock_gettime( CLOCK_REALTIME, &tmp_tv);
643c644
< memset(icp+1, 0, sizeof(struct timeval));
- - -
> memset(icp+1, 0, sizeof(struct timespec));
653,655c654,657
< static volatile int fake_fucked_egcs = sizeof(struct timeval);
< struct timeval tmp_tv;
< gettimeofday(&tmp_tv, NULL);
- - -
> static volatile int fake_fucked_egcs = sizeof(struct timespec);
52 ISSN 0236-3933. Вестник МГТУ им. Н.Э. Баумана. Сер. “Приборостроение”. 2012. № 4
1,2,3,4,5,6,7,8 10,11,12,13,14,15,16
Powered by FlippingBook