This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Time questions
- From: Andrew Lunn <andrew at lunn dot ch>
- To: FALL <birahim dot fall at elsys-design dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org, Andre-John Mas <ajmas at sympatico dot ca>
- Date: Fri, 3 Nov 2006 10:19:37 +0100
- Subject: Re: [ECOS] Time questions
- References: <200611030921.AA4020896004@elsys-design.com>
On Fri, Nov 03, 2006 at 09:21:22AM +0100, FALL wrote:
>
>
> ---------- Original Message ----------------------------------
> From: Andre-John Mas <ajmas@sympatico.ca>
> Date: Thu, 2 Nov 2006 19:16:45 -0500
>
> >Hi,
> >
> >I have been asked to correct an issue in our code. The time returned by the function:
> >
> > time( time_t* )
> >
> >returns the right value, when the system has been set using SNTP. The
> >issue is that a call to cyg_current_time() is made in part of our code, since a requirement had been made to have the time in
> >milliseconds. From what I can tell this function only returns the
> >time since the system booted and not the date as set by SNTP, which
> >seems to be maintained by the wallclock code? Is this correct?
> >
> >If my observation is right is there a suitable alternative call
> >that would allow to have calendar date/time in milliseconds?
> >
> >Andre
>
> If you want that time() returns the current time, you should have
> first set (correct) the current time by calling
> cyg_libc_time_settime(). The arg passed can the timestamp in second
> obtained from SNTP if you want to synchronnnise your
> system.
This is not necessary. The SNTP code will itself call this function.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss