Re: How To program for an Accurate sub-second clock

From: John Smith (soneone_at_microsoft.com)
Date: 07/05/04


Date: Mon, 5 Jul 2004 11:27:13 +0100


"Andrey Yatsyk" <andrew_NO_SPAM_@softspb.com> wrote in message
news:eDFcS7mYEHA.3972@TK2MSFTNGP12.phx.gbl...
> Set the timer with elapse period much less then a second and increment
your
> counters only when seconds value changnes.
> If this solution is not good for you for some reason, you can create
second
> thread that will invoke some method in first thread every second.
> For more info about system counters look at QueryPerformanceCounter and
> GetTickCount functions.
>
> --
> Andrey Yatsyk [eMVP]
>
>
> "John Smith" <soneone@microsoft.com> wrote in message
> news:ccb32g$lvq$1@newstree.wise.edt.ericsson.se...
> > Hi All
> >
> > I'm using EVC++ 4.0. I'm also new to MFC.
> >
> > I've used a timer event to provide a 'tick' which is then used to
> increment
> > my counters, and I display this as time
> > (hours:minutes:seconds:milliseconds).
> >
> > However, it seems very inaccurate.
> >
> > Is there an event from e.g. a real-time clock which I could use instead?
> It
> > would be nice to be able to count in say tenths of a second, but not
> > essential: minimum is to count seconds.
> >
> > Thanks
> >
> >
>
>

Hi Andrey

Thanks for the reply. I've tried (a single threaded app) to use an elapsed
period of 1 millisecond, 10ms, and 100ms. The clock itself only increments
in 1 second intervals. Within two minutes of running, it shows a large
discrepency as compared to a real stopwatch, in the order of a few seconds.
This is too inaccurate to work with.

I'll check out the functions you've mentioned.

Thanks



Relevant Pages

  • [PATCH] Light weight event counters V3
    ... The remaining counters in page_state after the zoned VM counter patch has ... We use a simple increment of per cpu variables. ...
    (Linux-Kernel)
  • [PATCH] Light weight event counters V4
    ... The remaining counters in page_state after the zoned VM counter patch has ... We use a simple increment of per cpu variables. ...
    (Linux-Kernel)
  • Re: Localhost traffic and ipfw rules
    ... the counters are not incrementing. ... would increment. ... The traffic is not present on lo0 or my internal interface. ...
    (FreeBSD-Security)
  • Re: Saving data in CPU on-chip EEPROM
    ... >>Use Gray Code for the counters. ... >increment taking place in that domain, ... >The conversion back and forth is relatively easy, ...
    (comp.arch.embedded)