output building log time

This commit is contained in:
slore 2019-03-16 12:47:17 +08:00
parent 24fd326a23
commit aae46b442f
2 changed files with 30 additions and 0 deletions

18
bin/Timer.vbs Normal file
View File

@ -0,0 +1,18 @@
Dim timer1, timer2, elapsed
If Wscript.Arguments.Count = 0 Then
Wscript.echo GetTimestamp
ElseIf Wscript.Arguments.Count = 2 Then
timer1 = Wscript.Arguments(0)
timer2 = Wscript.Arguments(1)
elapsed = DateDiff("s", CDate(timer1), CDate(timer2))
Wscript.echo elapsed
End If
Function GetTimestamp()
Dim N, timestamp
N = Now
timestamp = Year(N) & "-" & Right("0" & Month(N), 2) & "-" & Right("0" & Day(N), 2) & " "
timestamp = timestamp & Right("0" & Hour(N), 2) & ":" & Right("0" & Minute(N), 2) & ":" & Right("0" & Second(N), 2)
GetTimestamp = timestamp
End Function

View File

@ -30,6 +30,9 @@ set "LOGFILE=%Factory%\log\%WB_PROJECT%\%LOGSUFFIX%.log"
call :MKPATH "%LOGFILE%"
rem type nul>"%LOGFILE%"
set TIMER_START=
for /f "delims=" %%t in ('cscript.exe //nologo bin\Timer.vbs') do set TIMER_START=%%t
call :cecho PHRASE "%TIMER_START% - Building Start ..."
if "x%WB_BASE%"=="x" call :NO_ENV_CONF WB_BASE
set _WB_BASE_EXTRACTED=0
@ -199,6 +202,15 @@ rem =========================================================
call :CLEANUP 0
call WIM_Exporter "%_WB_PE_WIM%"
set TIMER_END=
for /f "delims=" %%t in ('cscript.exe //nologo "%WB_ROOT%\bin\Timer.vbs"') do set TIMER_END=%%t
set TIMER_ELAPSED=
for /f "delims=" %%t in ('cscript.exe //nologo "%WB_ROOT%\bin\Timer.vbs" "%TIMER_START%" "%TIMER_END%"') do set TIMER_ELAPSED=%%t
call :cecho PHRASE "%TIMER_END% - Building completed in %TIMER_ELAPSED% seconds."
goto :EOF
rem =========================================================