Time and NTP on RTEMS
Joel Sherrill
joel.sherrill at OARcorp.com
Mon Jan 29 18:13:27 UTC 2001
Eric Norum wrote:
>
> Jake Janovetz wrote:
> >
> > Hello...
> >
> > I've recently needed to integrate time into my RTEMS applications
> > and have a couple questions. I see that the NTP is supported, but only
> > in single-query mode (not a daemon). This should be adequate for what
> > I want. I have called time(), then localtime(), then strftime() to
> > get a printout of the current time, but I see that the time is off
> > by several hours, so I assume the timezone has not been properly
> > set. How is this supposed to be done in RTEMS?
> > Daemon mode of NTP is relatively complicated if I understand it
> > correctly (having to continually make small adjustments to slide the
> > device time to the proper time). Is this something currently under
> > development (for RTEMS)?
> >
>
> Right.
> RTEMS has no notion of timezone.
And this is an acknowledged deficiency. If someone can come
up with a nifty solution to adding this, I am all ears.
> The NTP client routine just sets
> gmtime with the value obtained from the NTP server. I put a hack in to
> allow an offset using the DHCP/BOOTP time-offset option. This makes
> gmtime wrong, but local time right.
>
> The offset, in seconds, from GMT is stored in rtems_bsdnet_timeoffset.
> Now that I look at the code, it appears to me that I've got the sign
> wrong -- the offset (which will be negative west of the prime meridian)
> should be added to the NTP base value.
>
> A true NTP client for RTEMS is on my to-do list, but way, way, waaaaay,
> down the list.
> --
> Eric Norum eric.norum at usask.ca
> Department of Electrical Engineering Phone: (306) 966-5394
> University of Saskatchewan FAX: (306) 966-5407
> Saskatoon, Canada.
--
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list