This script is not using a "timer" but rather the Min> function. It sets a variable to the current minute then checks for the next minute in a tight loop. The moment the minute updates, Datestamp> is called and the tight loop ends.
Code: Select all
Let>RP_Wait=1
Let>RP_Windowmode=0
DeleteFile>%temp_dir%DateStampPuzzlerTrial.txt
DeleteFile>%temp_dir%PuzzlerCPULoad.txt
Min>vMM
Dialog>Dialog1
object Dialog1: TForm
BorderIcons = [biSystemMenu]
Caption = 'Timing Test'
ClientHeight = 70
ClientWidth = 180
Color = 16177200
Position = poScreenCenter
object MSButton1: tMSButton
Left = 50
Top = 40
Width = 75
Height = 25
Caption = 'Close'
TabOrder = 0
DoBrowse = False
BrowseStyle = fbOpen
end
object Label1: TLabel
Left = 55
Top = 16
Width = 52
Height = 13
Caption = 'Cycles'
end
end
EndDialog>Dialog1
GetTime>vPreTime
SetDialogProperty>Dialog1,,Caption,vPreTime
AddDialogHandler>Dialog1,MSButton1,OnClick,Quit
AddDialogHandler>Dialog1,,OnClose,Quit
Show>Dialog1
Let>vCycleCount=0
GoSub>GetCPU
Label>ReTime
GetTime>vPreTime
SetDialogProperty>Dialog1,,Caption,vPreTime
//A second of tight loop
Sec>vSS
If>vSS>58
LibFunc>Winmm,timeBeginPeriod,vResB,1
Label>NoWait
Min>vMM2
If>%vMM%<>%vMM2%
DateStamp>%temp_dir%DateStampPuzzlerTrial.txt,vData
Let>vMM=vMM2
DeleteFile>%temp_dir%PuzzlerCPULoad.txt
GoSub>GetCPU
Add>vCycleCount,1
SetDialogProperty>Dialog1,Label1,Caption,Cycles = %vCycleCount%
LibFunc>Winmm,timeEndPeriod,vResE,1
Goto>Control
EndIf
Goto>NoWait
EndIf
Label>Control
Wait>0.01
Goto>ReTime
SRT>GetCPU
RunProgram>cmd /c wmic cpu get loadpercentage > %temp_dir%PuzzlerCPULoad.txt
ReadLn>%temp_dir%PuzzlerCPULoad.txt,2,vData
Trim>vData,vData
END>GetCPU
SRT>Quit
LibFunc>Winmm,timeEndPeriod,vResE,1
ExecuteFile>%script_Dir%\Analyze_timestamp_Output.scp
Exit>0
END>Quit
Long stretch of 00:000s
2022-07-07:20:22:00:000 - 29
2022-07-07:20:23:00:000 - 17
2022-07-07:20:24:00:000 - 16
2022-07-07:20:25:00:000 - 29
2022-07-07:20:26:00:000 - 21
2022-07-07:20:27:00:000 - 20
2022-07-07:20:28:00:000 - 22
2022-07-07:20:29:00:000 - 9
2022-07-07:20:30:00:000 - 14
2022-07-07:20:31:00:000 - 18
2022-07-07:20:32:00:000 - 10
2022-07-07:20:33:00:000 - 15
2022-07-07:20:34:00:000 - 28
2022-07-07:20:35:59:037 - 43 < Until here. Note this is almost a 2 minute cycle, minute 34 to minute 36.
2022-07-07:20:36:59:011 - 13
2022-07-07:20:37:59:013 - 17
2022-07-07:20:38:59:015 - 25
2022-07-07:20:39:59:015 - 13
2022-07-07:20:40:59:002 - 11
2022-07-07:20:41:59:013 - 10
2022-07-07:20:42:59:006 - 9
2022-07-07:20:43:59:009 - 25
2022-07-07:20:44:59:010 - 23
2022-07-07:20:45:59:013 - 24
2022-07-07:20:46:59:014 - 19
And it continued like this until I stopped it the next morning.
One time it went very well for 7 hours with nearly no errors until midnight. At the midnight minute DateStamp> stopped for 15 minutes and when it continued it looked very much like the above list except it was not all second 59 and there were other gaps where nothing printed for several minutes.
I've examined the code and can see no reason for this. My suspicion is that virus software is causing the code to stop processing completely for stretches at a time. Maybe someone else can see where I've caused the issue or can confirm that it's an interference issue.