diff --git a/manycast/manycast_client.c b/manycast/manycast_client.c index 13d0aa9412ae1ff7bbb018bd43b161b768c966fe..b37156e33dc04fb2c6bbf41e77127e825a5f51b5 100644 --- a/manycast/manycast_client.c +++ b/manycast/manycast_client.c @@ -299,8 +299,11 @@ int main( int argc, char* argv[ ] ){ sys_offset.seconds = (t2.seconds - t1.seconds) + (t3.seconds - t4.seconds) /2; sys_offset.fractions = (t2.fractions - t1.fractions) + (t3.fractions - t4.fractions) /2; - printf("delay: %ld.%.6ld\n", delay.seconds, delay.fractions); - printf("system off set: %ld.%.6ld\n", sys_offset.seconds, sys_offset.fractions); + printTime(&recPacket, &sys_offset, &delay); + printf(" +%ld.%.6ld", delay.seconds, delay.fractions); + printf(" +-%ld.%.6ld\n", sys_offset.seconds, sys_offset.fractions); + printf("\n"); + // @@ -313,31 +316,4 @@ int main( int argc, char* argv[ ] ){ } -/*void printTime (struct sntp_packet* packet, struct timeval* tv, struct timeStamp* offset, struct timeStamp* delay) - -{ -char buffer[26]; -struct tm* tm_info; - - //unsigned long int originateseconds = ntohl(ts->originate.seconds) - DELTA; - //unsigned long int originatefractions = ntohl(ts->originate.fraction); - //unsigned long int transmitseconds = ntohl(ts->transmit.seconds) - DELTA; - //unsigned long int transmitfractions = ntohl(ts->transmit.fraction); - //unsigned long int receivedseconds = ntohl(ts->received.seconds) - DELTA; - //unsigned long int receivedfractions = ntohl(ts->received.fraction); - - tm_info = localtime(&packet.transmit.seconds); - strftime(buffer, 26, "%Y-%m-%d %H:%M:%S", tm_info); - printf("%s", buffer); - - printf(".%lu", packet.transmit.fractions/1000); - printf(" +%f", offset.seconds); - - - -} - -*/ - //double offsetseconds = ((receivedseconds - originateseconds) + (transmitseconds - tv->tv_usec)) / 2; - //double offsetfractions = ((receivedseconds - originateseconds) + (transmitseconds - tv->tv_usec)) / 2;