[ECOS] More Wallclock questions

Jonathan Larmour jlarmour@redhat.com
Tue Dec 4 23:57:00 GMT 2001

Grant Edwards wrote:
> I've gottem my wallclock driver working, but I'm confused about
> soemthing.
> The "eCos" time (cyg_current_time()) now seems to be completely
> decoupled from wall-clock time (time()).  Everytime time() is
> called, the HW clock is read.
> What I had expected was that eCos would set it's system time
> based on the HW clock at startup, and from then on, the eCos
> system time would be used for everything: time() and
> cyg_current_time() would be referencing the same time-base.
> Since the two times are no longer linked, how does one do
> things like set an alarm event for a particular wallclock time?
> I suppose one could create a timer and set its value to the
> current value of the HW clock, and then set an alarm.  But
> since the system time isn't linked to the wallclock time,
> they're going to drift apart so that the time() value when the
> event happens may not be what was expected.  Right?  

Yes this is something we've known about, but have never gotten round to
fixing[1]. time() should be instantiated from the wallclock driver only
once, and from then on should use the kernel's ticks to keep track of time.

> IIUC,This
> didn't used to happen before I enabled the HW RTC driver.

Because then you would have used the "emulated" wallclock, which is driven
from the kernel RTC; so it ergo _must_ be linked.


[1] At the point time() was written, the only wallclock driver *was* the
emulated one!
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine

More information about the Ecos-discuss mailing list