PDA

View Full Version : How to calculate build time


maorlast2
01-09-2012, 01:16 AM
I created these build time events

Application.Macros(vbldTemporary).Add "START_TIME", vbld_FormatTime()
Application.Macros(vbldTemporary).Add "START_TIME_EX", vbld_FormatDateEx(now,"hh:MM:SS")

Application.Macros(vbldTemporary).Add "END_TIME", vbld_FormatTime()
Application.Macros(vbldTemporary).Add "END_TIME_EX", vbld_FormatDateEx(now,"hh:MM:SS")

(_EX means that this is expression that i print in the log)
How can i calculate the build time?

kinook
01-09-2012, 08:07 AM
There is a property on the build object with the build start time:
http://www.kinook.com/VisBuildPro/Manual/starttimeproperty.htm

And to calculate:sec = DateDiff("s", Builder.StartTime, Now)
hr = Int(sec / 3600)
sec = sec - hr * 3600
min = Int(sec / 60)
sec = Int(sec Mod 60)

' format in hh:mm:ss format
strElapsed = vbld_PadLeft(CStr(hr), 2, "0") & ":" & _
vbld_PadLeft(CStr(min), 2, "0") & ":" & vbld_PadLeft(CStr(sec), 2, "0")

http://www.w3schools.com/vbscript/func_datediff.asp

maorlast2
01-09-2012, 09:20 AM
if i will follow your approach, how can substring 'Builder.StartTime' and 'Now' to take only the time without the date

i.e:
1/9/2012 17:16:36 --> 17:16:36

(i want to save the start and end time in a variable)

Thanks

kinook
01-09-2012, 10:02 AM
http://www.w3schools.com/vbscript/func_timevalue.asp