🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #2111

Inaccuracy in windows timer?

#2111
From: jav
Date: Wed, 18 Nov 1992 17:31
21 lines
1525 bytes
Windows timer inaccuracy!

I have an application which needs to sample a value every 60 seconds.  I use
the settimer function with an interval of 60000 to send a message to the
appropriate window which invokes the relevant member function to do the
sampling (I'm using Boralnd C++ 3.1 with OWL).  This all works fine except that
the sampling time actually creeps by about 1 second every thirty minutes.  I
store the time (obtained using standard C time.h functions from the PC clock)
in a file with every sample and after thirty minutes or so, the sampling occurs
one second later in the minute than originally.

I realise that the windows timer is only accurate to 18.2 ms, but surely the
settimer function is able to correct for non-multiple of 18.2 ms intervals
(obviously not!).  If not, then does any Guru out there know how I can correct
the time to accurately be able to sample every sixty seconds?

Thanks in advance,                         jav@itd.dsto.gov.au
Jon Vaughan
Information Technology Division
D.S.T.O.
Salisbury, South Australia 5108.
Technical Details
Message-ID: <1992Nov18.113155.165165@dstos3.dsto.gov.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!elroy.jpl.nasa.gov!usc!rpi!batcomputer!munnari.oz.au!yoyo.aarnet.edu.au!news.adelaide.edu.au!dstos3.dsto.gov.au!jav

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!elroy.jpl.nasa.gov!usc!rpi!batcomputer!munnari.oz.au!yoyo.aarnet.edu.au!news.adelaide.edu.au!dstos3.dsto.gov.au!jav
From: jav@dstos3.dsto.gov.au
Newsgroups: comp.os.ms-windows.programmer.misc
Subject: Inaccuracy in windows timer?
Message-ID: <1992Nov18.113155.165165@dstos3.dsto.gov.au>
Date: 18 Nov 92 11:31:54 CST
Organization: Defence Science and Technology Organisation
Lines: 21