Re: Get time & milliseconds.
- From: "Chris Tacke, MVP" <ctacke.at.opennetcf.dot.com>
- Date: Tue, 1 Jul 2008 12:14:01 -0500
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.
>
.
- References:
- Re: Get time & milliseconds.
- From: Paul G. Tobey [eMVP]
- Re: Get time & milliseconds.
- From: ag
- Re: Get time & milliseconds.
- Prev by Date: Re: Get time & milliseconds.
- Next by Date: Re: Get time & milliseconds.
- Previous by thread: Re: Get time & milliseconds.
- Next by thread: Re: Get time & milliseconds.
- Index(es):
Relevant Pages
|