sec = (uint32_t)(now/1000000); /* convert to seconds */
ntp_sec = sec+NTP_TIME_OFFSET; /* convert to NTP seconds */
ntp_usec = (uint32_t)(now - ((switch_time_t) sec*1000000)); /* remove seconds to keep only the microseconds */
lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; /* 0.065536 is used for convertion from useconds to fraction of 65536 (x65536/1000000) */
/* Delay since Last Sender Report (DLSR) : 32bits, 1/65536 seconds */
/* Delay since Last Sender Report (DLSR) : 32bits, 1/65536 seconds */
lsr_now=(uint32_t)(ntp_usec*0.065536)|(ntp_sec&0x0000ffff)<<16;/* 0.065536 is used for convertion from useconds to fraction of 65536 (x65536/1000000) */
if (stats->last_recv_lsr_local) {
if (stats->last_recv_lsr_local) {
dlsr=lsr_now-stats->last_recv_lsr_local;
uint32_t lsr_now = calc_local_lsr_now();
}else{
/* check lsr_now: what we just read from clock may be in the past (race cond), don't send huge dlsr due to uint wrap around */