TickCount: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Created by user: [[{{ns:2}}:Instructor|Instructor]] ([[{{ns:3}}:Instructor|talk]], [[{{ns:-1}}:Contributions/Instructor|contrib]]).)
 
m (Adding new author and category links.)
Line 1: Line 1:
{|align=right
{{PageAuthor|Instructor}}
|<small>Author: [[{{ns:2}}:Instructor|Instructor]] ([[{{ns:3}}:Instructor|talk]], [[{{ns:-1}}:Contributions/Instructor|contrib]])</small>
 
|}
<br style="clear:both;">
== The Function ==
== The Function ==
<highlight-nsis>/*
<highlight-nsis>/*
Line 73: Line 71:
</highlight-nsis>
</highlight-nsis>


[[{{ns:14}}:Date & Time Functions]]
[[Category:Date & Time Functions]]

Revision as of 13:57, 24 June 2005

Author: Instructor (talk, contrib)


The Function

/*
____________________________________________________________________________
 
                            TickCount
____________________________________________________________________________
 
Thanks kike_velez (Based on his code)
 
 
Get completion time of the some process.
 
 
Syntax:
${TickCountStart}
 
# ... code ...
 
${TickCountEnd} $var
 
# $var=Elapsed time since start in milliseconds
 
 
Note:
${TickCountStart} use stack to save inicial time
 
 
 
Example:
Section
	${TickCountStart}
	MessageBox MB_OK "TickCount started"
 
	${TickCountEnd} $0
	MessageBox MB_OK "Message showed: $0 ms"
SectionEnd*/
 
 
;---------------------------------------------------------------------------
 
Function TickCountStart
	!define TickCountStart `!insertmacro TickCountStartCall`
 
	!macro TickCountStartCall
		Call TickCountStart
	!macroend
 
	Push $0
	System::Call 'kernel32::GetTickCount()i .r0'
	Exch $0
FunctionEnd
 
Function TickCountEnd
	!define TickCountEnd `!insertmacro TickCountEndCall`
 
	!macro TickCountEndCall _RESULT
		Call TickCountEnd
		Pop ${_RESULT}
	!macroend
 
	Exch $0
	Push $1
	System::Call 'kernel32::GetTickCount()i .r1'
	System::Int64Op $1 - $0
	Pop $0
	Pop $1
	Exch $0
FunctionEnd