Report Installation Time At The End

From NSIS Wiki
Jump to navigationJump to search
Author: n0On3 (talk, contrib)


Description

Here's what I use for reporting in seconds how long did the installation take.

The idea to take the current time was mentioned by Justin here

The Script

Put this as the very first section:

Section "-StartTime"
  SetDetailsPrint "none"
  GetTempFileName $R5
  GetFileTime $R5 $R8 $R9 # push $R9 to the stack if you need that variable
  Delete $R5
  #DetailPrint "Start Time in two 32bits numbers: $R8, $R9"
SectionEnd

And this for the very last:

Section "-EndTime"
  GetTempFileName $R5
  GetFileTime $R5 $R6 $R7
  Delete $R5
  #DetailPrint "End Time in two 32bits numbers: $R6, $R7"
  #DetailPrint "Initial time: $R9"
  IntOp $R7 $R7 - $R9
  IntOp $R7 $R7 / 10000000
  DetailPrint "Elapsed Time: $R7 seconds."
SectionEnd

I use $R9 to store the time in the whole script, so if you use all 20 variables you can use the stack to store the initial time.