GetTimeSimple
From NSIS Wiki
Jump to navigationJump to search
Author: saivert (talk, contrib) |
Description
This is a simpler version of the GetTime macro, except it only gives you the current local time.
Usage
Call GetCurrentTime Pop $R0 ; $R0 = local time Call GetCurrentDate Pop $R0 ; $R0 = local date
The Function
; My time functions ; GetCurrentTime ; Written by Saivert ; Description: ; Uses System.dll plugin to call Win32's GetTimeFormat in order ; to get the current time as a formatted string. Function GetCurrentTime Push $R9 Push $R8 System::Alloc ${NSIS_MAX_STRLEN} Pop $R8 System::Call 'kernel32::GetTimeFormat(i0,i0,i0,i0,iR8,i${NSIS_MAX_STRLEN}) i..' System::Call '*$R8(&t${NSIS_MAX_STRLEN} .R9)' System::Free $R8 Pop $R8 Exch $R9 FunctionEnd ; GetCurrentDate ; Written by Saivert ; Description: ; Uses System.dll plugin to call Win32's GetDateFormat in order ; to get the current date as a formatted string. Function GetCurrentDate Push $R9 Push $R8 System::Alloc ${NSIS_MAX_STRLEN} Pop $R8 System::Call 'kernel32::GetDateFormat(i0,i0,i0,i0,iR8,i${NSIS_MAX_STRLEN}) i..' System::Call '*$R8(&t${NSIS_MAX_STRLEN} .R9)' System::Free $R8 Pop $R8 Exch $R9 FunctionEnd