PDA

View Full Version : Calculate duration based on %DATETIME%


Shuang
03-25-2004, 08:02 AM
I want to benchmark the performance of an application. What would be the best way to calculate a duration based on %DATETIME% at the beginning and ending. Can it be done without VS or J scripting?

Thanks.

rajivraj
03-26-2004, 01:05 AM
Am not sure if this is the best way, but :

1. Insert a "Set Macro" action as the first step and set the value of the macro value as %DATETIME%

2. Insert a "Run Script" action as the last step. Here you can use the marco of the first step and the %DATETIME% to compare the time difference.

Hope that helps.

Cheers!
Rajiv. R
Rajspace.Org

kinook
03-26-2004, 06:46 AM
Scripting would be necessary. The following in a Log Message step at the end of the build would give the build time in seconds (VBScript must be the default script language in Tools | Application Options | General):

Build elapsed time = [DateDiff("s", Builder.StartTime, Now)] seconds

Or in a Run Script step (if VBScript is not the default language):

Builder.LogMessage "Build elapsed time = " & DateDiff("s", Builder.StartTime, Now) & " seconds"

Or to get a different time interval, get the start time as mentioned in the previous post and replace Builder.StartTime with CDate("%START_TIME%") replacing START_TIME with whatever macro name you used.

digit
07-17-2009, 09:45 AM
Since I love JScript (and hate VBScript), doing an elapsed time calculation in JScript is...
var seconds = Math.floor((new Date() - new Date(Builder.StartTime)) / 1000);

mevans
09-12-2016, 12:47 PM
I was also looking for the elapsed time. I see how to do it from the post. As this post was a few years ago, is that still the best way to get the elapsed time, or are there any built-in macros or functions that return it?

It's no big deal if this is still the best way to do it; I'm just checking as Visual Build has had enhancements since this information.

kinook
09-12-2016, 05:07 PM
That's still the best way.