Re: Get time & milliseconds.

Tech-Archive recommends: Speed Up your PC by fixing your registry



The DS1307 is a popular I2C RTC as well. Industrial temp and it even has a little NVRAM in it you can use for other stuff.

http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2688

-Chris


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com> wrote in message news:eZhrF852IHA.4928@xxxxxxxxxxxxxxxxxxxxxxx
For example, the following RTC chip from Maxim:

http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4051

+/-1.8min/year over industrial temperature range. SPI interface, like most of the ordinary clocks out there.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com> wrote in message news:OOaZY352IHA.3544@xxxxxxxxxxxxxxxxxxxxxxx
The OS doesn't care one way or the other what *YOU* return from reading your real-time clock. If you are not returning ms from OEMGetRealTime(), then it's your fault that applications calling GetSystemTime() don't get ms. Windows CE isn't enforcing a lack of ms resolution detail!

Again, with respect to NTP and system drift, YOU can do that. For Microsoft, the people who care about highly-accurate, sub-second real time clocks is a tiny, tiny, miniscule market. 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.

Paul T.

"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.
    ... Paul T. ... time clock), or built in and calibrate real-time clock hardware. ... I track a seconds transition and record the systemtime & tickcount, ...
    (microsoft.public.windowsce.app.development)
  • 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. ... 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: 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 OS doesn't care one way or the other what *YOU* return from reading your ... clock), or built in and calibrate real-time clock hardware. ... I track a seconds transition and record the systemtime & tickcount, ...
    (microsoft.public.windowsce.app.development)