Problem with _TOD_Set
rtems
rtems.thysys at tiscalinet.it
Tue Sep 17 13:22:33 UTC 2002
During our tests we had a problem updating the internal Time of Day.
If we do a rtems_bsdnet_synchronize_ntp() call, we verify that sometimes the date returned from rtems_clock_get() has the ticks field greater then 1000 ms/_TOD_Ticks_per_second.
If we watch the _TOD_Set function (c/src/exec/score/src/coretodset.c) we can observe that the test on ticks_until_next_second is based on the old _TOD_Current.ticks:
-------------------------------------------------------------------------------------------------------------------
ticks_until_next_second = _TOD_Ticks_per_second;
if ( ticks_until_next_second > _TOD_Current.ticks ) <----
ticks_until_next_second -= _TOD_Current.ticks; <----
_TOD_Current = *the_tod;
_TOD_Seconds_since_epoch = seconds_since_epoch;
_TOD_Is_set = TRUE;
_TOD_Activate( ticks_until_next_second );
------------------------------------------------------------------------------------------------------------------
After the test, '_TOD_Current.ticks' is updated with the new value stored in the parameter 'the_tod' but obviously previous calculated 'ticks_until _next second' is uncorrelated with the new value '_TOD_Current'.
We avoided the problem updating '_TOD_Current' before the test:
--------------------------------------------------------------------------------------------------------------------
_TOD_Current = *the_tod;
_TOD_Seconds_since_epoch = seconds_since_epoch;
_TOD_Is_set = TRUE;
ticks_until_next_second = _TOD_Ticks_per_second;
if ( ticks_until_next_second > _TOD_Current.ticks )
ticks_until_next_second -= _TOD_Current.ticks;
_TOD_Activate( ticks_until_next_second );
-------------------------------------------------------------------------------------------------------------------
Before the patch we are unable to obtain a NTP synchronization between different CPUs on Ethernet network better then 1 Sec
After the patch we are capable to obtain synchronization in term of 1 tick system CPU clock between CPUs.
Can anyone confirm the problem or is there an error in our analysis?
Thanks in advance.
Fabrizio Pirovano
THYSYS s.r.l.
Milan Italy
pirovano.thysys at tiscalinet.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20020917/04295c1f/attachment.html>
More information about the users
mailing list