refclock_shm.c (293423) | refclock_shm.c (294554) |
---|---|
1/* 2 * refclock_shm - clock driver for utc via shared memory 3 * - under construction - 4 * To add new modes: Extend or union the shmTime-struct. Do not 5 * extend/shrink size, because otherwise existing implementations 6 * will specify wrong size of shared memory-segment 7 * PB 18.3.97 8 */ --- 586 unchanged lines hidden (view full) --- 595 ntpcal_time_to_date(&cd, &ts); 596 597 /* add ntpq -c cv timecode in ISO 8601 format */ 598 c = snprintf(pp->a_lastcode, sizeof(pp->a_lastcode), 599 "%04u-%02u-%02uT%02u:%02u:%02u.%09ldZ", 600 cd.year, cd.month, cd.monthday, 601 cd.hour, cd.minute, cd.second, 602 (long)shm_stat.tvt.tv_nsec); | 1/* 2 * refclock_shm - clock driver for utc via shared memory 3 * - under construction - 4 * To add new modes: Extend or union the shmTime-struct. Do not 5 * extend/shrink size, because otherwise existing implementations 6 * will specify wrong size of shared memory-segment 7 * PB 18.3.97 8 */ --- 586 unchanged lines hidden (view full) --- 595 ntpcal_time_to_date(&cd, &ts); 596 597 /* add ntpq -c cv timecode in ISO 8601 format */ 598 c = snprintf(pp->a_lastcode, sizeof(pp->a_lastcode), 599 "%04u-%02u-%02uT%02u:%02u:%02u.%09ldZ", 600 cd.year, cd.month, cd.monthday, 601 cd.hour, cd.minute, cd.second, 602 (long)shm_stat.tvt.tv_nsec); |
603 pp->lencode = (c < sizeof(pp->a_lastcode)) ? c : 0; | 603 pp->lencode = (c > 0 && (size_t)c < sizeof(pp->a_lastcode)) ? c : 0; |
604 605 /* check 1: age control of local time stamp */ 606 tt = shm_stat.tvc.tv_sec - shm_stat.tvr.tv_sec; 607 if (tt < 0 || tt > up->max_delay) { 608 DPRINTF(1, ("%s:SHM stale/bad receive time, delay=%llds\n", 609 refnumtoa(&peer->srcadr), (long long)tt)); 610 up->bad++; 611 msyslog (LOG_ERR, "SHM: stale/bad receive time, delay=%llds", --- 52 unchanged lines hidden --- | 604 605 /* check 1: age control of local time stamp */ 606 tt = shm_stat.tvc.tv_sec - shm_stat.tvr.tv_sec; 607 if (tt < 0 || tt > up->max_delay) { 608 DPRINTF(1, ("%s:SHM stale/bad receive time, delay=%llds\n", 609 refnumtoa(&peer->srcadr), (long long)tt)); 610 up->bad++; 611 msyslog (LOG_ERR, "SHM: stale/bad receive time, delay=%llds", --- 52 unchanged lines hidden --- |