Answer the question
In order to leave comments, you need to log in
Success counter per minute in Delphi?
I'm trying to make a counter of operations per minute, I'm already tired, I found this code in c ++, how can I transfer it to delphi?
var temp = 0;
for (int i = FailedList.Count() - 1; i >= 0; i--) { if ((DateTime.Now - FailedList[i].Time).TotalSeconds > 60) break; temp++; }
cpm = temp;
CPM := CHECKEDCount div ((DATENOWunix - STARTTIMEunix) div 60000);
Answer the question
In order to leave comments, you need to log in
Use tiki. GetTickCount is the OS counter.
var Save := GetTickCount;
<do something>
var Delta := GetTickCount - Save; <- Тут кол-во миллисекунд, потраченное на действие выше
Usually unix calendar is measured in seconds, and only in JS exception with milliseconds. If it's true milliseconds, maybe then replace the div's integer division with a floating point operation /
It's also a good practice to use non-civil calendar if possible, but monotonic time. In the Ada language, this is an appendix to the D.8 Monotonic Time standard that describes the Ada.Real_Time package . In Delphi, the same functionality is hidden in a module with the obscure name System.Diagnostics . This is if the program does not restart during the entire interval of interest.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question