Timer
How can I do this:
1. Create timer (state: 0ms)
2. (do some operations)
3. Get elapsed time since timer start (state e.g.: 1050ms)
4. Kill timer
Archive: Timer
Timer
How can I do this:
1. Create timer (state: 0ms)
2. (do some operations)
3. Get elapsed time since timer start (state e.g.: 1050ms)
4. Kill timer
Could you use some API call (I don't know what OS you're using) to get the current time, store it in a var, then when you want to compare, get the (new) current time, and subtract?
RobGrant, I know that I can use API calls but
-kernel32::GetLocalTime returns always zero in milliseconds variable
-I found only user32::SetTimer and user32::KillTimer and no command for get state
Hello
MSDN information
GetTickCount
The GetTickCount function retrieves the number of milliseconds that have elapsed since the system was started. It is limited to the resolution of the system timer. To obtain the system timer resolution, use the GetSystemTimeAdjustment function.
DWORD GetTickCount(void);
Nsis solution
Best RegardsSection "timer" timer
::Alloc 400
System
pop$2
System::Call 'kernel32::GetTickCount()i .r0'
>System::Free $2
MessageBox MB_OK "Inicial Time $0 in ms"
>System::Alloc 400
pop$2
System::Call 'kernel32::GetTickCount()i .r1'
>System::Free $2
IntOp$1 $1 - $0
MessageBox MB_OK "Time before start $1 in ms"
>SectionEnd
>
This is exactly what I want. Thanks, kike_velez!
Ah cool, this is something that we've always needed and hopefully it actually works (the old solutions on the archive, including mine didn't work very well).
-Stu