home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / mswindo / programm / misc / 3506 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  1.5 KB

  1. Path: 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
  2. From: jav@dstos3.dsto.gov.au
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Inaccuracy in windows timer?
  5. Message-ID: <1992Nov18.113155.165165@dstos3.dsto.gov.au>
  6. Date: 18 Nov 92 11:31:54 CST
  7. Organization: Defence Science and Technology Organisation
  8. Lines: 21
  9.  
  10. Windows timer inaccuracy!
  11.  
  12. I have an application which needs to sample a value every 60 seconds.  I use
  13. the settimer function with an interval of 60000 to send a message to the
  14. appropriate window which invokes the relevant member function to do the
  15. sampling (I'm using Boralnd C++ 3.1 with OWL).  This all works fine except that
  16. the sampling time actually creeps by about 1 second every thirty minutes.  I
  17. store the time (obtained using standard C time.h functions from the PC clock)
  18. in a file with every sample and after thirty minutes or so, the sampling occurs
  19. one second later in the minute than originally.
  20.  
  21. I realise that the windows timer is only accurate to 18.2 ms, but surely the
  22. settimer function is able to correct for non-multiple of 18.2 ms intervals
  23. (obviously not!).  If not, then does any Guru out there know how I can correct
  24. the time to accurately be able to sample every sixty seconds?
  25.  
  26. Thanks in advance,                         jav@itd.dsto.gov.au
  27. Jon Vaughan
  28. Information Technology Division
  29. D.S.T.O.
  30. Salisbury, South Australia 5108.
  31.