Setting the system clock with excel

  • Thread starter Thread starter ccdubs
  • Start date Start date
C

ccdubs

Hi,

I run a macro in an infinite loop for logging purposes. The problem is that
this seems to slow down the system clock.

One of the variables I am logging is a reference to time set on an external
device. Is it possible to use this to reset the system clock periodically?

Many thanks.
 
what about using the OnTime event rather than an infinite loop?

Guido

HoloGuides
http://hologuides.com/programming/ExcelVBA


jaf said:
Hi,
Running a macro in an infinite loop will slow the system clock because
Windows isn't getting enough CPU cycles.
Do you use DoEvents in your loop?


--

John

johnf202 at hotmail dot com


ccdubs said:
Tom,

The system clock only slows down when the macro is running, otherwise it
remains fairly accurate.

I too was surprised at this and as yet I am unable to explain it.

All the macro does is write data to a text file and would be easy enough to
simulate if you are interested in trying it overnight on your own computer.
 
The "catch 22" is that I want as many cycles as possible and an accurate
time stamp.

I think I have resolved the issue (thanks to you all). The device that I am
reading data from has its own clock and I am using that clock as my time
stamp and I will also use it every hour or so to reset the system clock.
Just to keep things tidy.

Many thanks.

Guido said:
what about using the OnTime event rather than an infinite loop?

Guido

HoloGuides
http://hologuides.com/programming/ExcelVBA
 
Back
Top