View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Martin[_16_] Martin[_16_] is offline
external usenet poster
 
Posts: 13
Default Reset system clock?

I am using excel to download data from three financial websites once a
minute from each. As I cannot always rely on the "Trade Time" shown on the
sites, I use system time ("=Time") to act as a comparison,

i.e. if system time <trade time then... ,

I trade the markets daily and would probably be "in" for only a short
period, the fact that the system time appears to slow down over the day when
the procedure is running is not much more than an irritant and I can work
around it by manually resetting the clock or rebooting.

Having looked through Google and

http://support.microsoft.com/?kbid=189706

and not getting much further, I wondered if there was a practical way to
remove/rectify said irritant.

Thank you for all replies, I'll look at it further at the weekend when the
markets are closed.

Martin

Chip Pearson wrote in message
...
And the point of hard-coding the time of day when setting the
system clock would be what?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"AA2e72E" wrote in message
...
In the ThisWorkbook module, try:

Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare Function SetSystemTime Lib "kernel32"

(lpSystemTime As SYSTEMTIME) As Long
Sub ResetClock()
Dim lpSystemTime As SYSTEMTIME
lpSystemTime.wDayOfWeek = -1
lpSystemTime.wDay = 24
lpSystemTime.wYear = 2004
lpSystemTime.wMonth = 5
lpSystemTime.wHour = 15
lpSystemTime.wMinute = 32
lpSystemTime.wSecond = 0
lpSystemTime.wMilliseconds = 0
SetSystemTime lpSystemTime
End Sub