Re: Get time & milliseconds.



The OAL has the implementation for GetSystemTime and SetSystemTime, so it can be adjusted to set and get it in any manner you desire, whether from hardware, NTP, a GPS receiver, an atomic clock or a sun dial is completely up to the OEM. The default implementation typically just reads and writes from an on-board RTC, which very, very often has 1s resolution. Since the mechanism for the set and get methods are in the OAL and compiled into the kernel, there's no ability to change how it works once the CE imge has been generated (unless the OEM provided some custom hook to allow for it of course).

-Chris



"ag" <ag@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:3224248B-6940-4BD3-9B31-A6A69E9DE811@xxxxxxxxxxxxxxxx
Paul,

Thanks.

Clock is kept in an external RTC, without ms "details".

I track a seconds transition and record the systemtime & tickcount, checking
that all this is done within some ms. Then when I need SystemTime with ms, I
add the elapsed tickcount to the recorded systemtime.

I update the recorded systemtime &tickcount every xx minutes.

Of course this solution isn't accurate, but I only need sub seconds
resolution to organise and track different events within a seconds.

This soft runs on a winCE 6.0. Isn't there a "full" software time keeping ?
It would be interesting to be able to:
- sync the device with NTP, not SNTP
- adapt system tick to compensate drift.

regards,
arnaud.

"Paul G. Tobey [eMVP]" wrote:

You can't do what you're describing. The low-level operations that generate
the tick count are not connected to the hardware that returns the clock
time. The only real answer is to have a real-time clock accurate to ms.
Yes, it's possible that there's some way, on your hardware, to get an
interrupt when the seconds from the real-time clock tick, but that's not the
case on most hardware, so there's not going to be an OS-level function for
doing that.

So, what you could do, is, in a high-priority thread, poll the real-time
clock for a seconds transition and read the tick count at that moment.
You'd then have to call that zero and use it from then on to figure out what
ms value to use. However, of course, over time things are going to drift
and, by the end of the day, it's quite likely that your calculation will be
completely worthless.

Are you sure that you can't use delta times calculated from GetTickCount()
for what you need? If not, explain.

Paul T.

"ag" <ag@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FA8A4ABE-84CC-4609-A745-C53533C46EEC@xxxxxxxxxxxxxxxx
> Hello,
>
> I would like to record the actual time when a specific interrupt > occurs.
> Using GetSystemTime limits resolution to seconds, and I need
> milliseconds...
> What is the best solution ?
>
> GetTickCount returns milliseconds from the start of the device. I could
> have
> a thread waiting each start of a new second and record the tickcount. > How
> can
> I generate an event triggered when system time updates its seconds ?
>
> thanks for any help !
> arnaud.
>




.



Relevant Pages

  • Re: Get time & milliseconds.
    ... Those of us who have some reason to care, either synchronize, to 1s, frequently (you're building a time clock), or built in and calibrate real-time clock hardware. ... Then when I need SystemTime with ms, ... adapt system tick to compensate drift. ...
    (microsoft.public.windowsce.app.development)
  • Re: Get time & milliseconds.
    ... Clock is kept in an external RTC, ... I track a seconds transition and record the systemtime & tickcount, ... Then when I need SystemTime with ms, ... adapt system tick to compensate drift. ...
    (microsoft.public.windowsce.app.development)
  • Re: Get time & milliseconds.
    ... the tick count are not connected to the hardware that returns the clock ... The only real answer is to have a real-time clock accurate to ms. ... interrupt when the seconds from the real-time clock tick, ...
    (microsoft.public.windowsce.app.development)
  • Re: clock stops, U5/10 Solaris 8
    ... It sounds like the hardware TOD clock is stuck. ... software clock. ... The software clock is simply a counter that is incremented each "tick". ...
    (comp.unix.solaris)
  • Re: Coding style, wait statement, sensitivity list and synthesis.
    ... >> least assume that XST supports this style and create this hardware. ... >>>then the higher precedence clock must be coded first. ... For these very rare dual-edge sensitive register, yes, I think instantiation ... Dual-edge sensitive register elements is not common practice in hardware design. ...
    (comp.lang.vhdl)