Final Builder - Read the build (run) time value in to a variable

I am looking for a way to get the buid time ("Run Time" value, as shown in the Run dialog), in order to send this information on an email action, reporting how long the build took.  I know that a variable like that is available in FinalBuilderServer, and I am looking for its equivalent in FinalBuilder.

Also, I am looking for a way to grab the BuildLog and add it into the email action's email body.

Any suggestions would be apriciated.

Thanks,

Hanoch

Hi Hanoch,

To get the elapsed time of the build you can either use the ‘Get DateTime’ action to get the current date & time at the start of the build and store it in a variable and then again at the end of the build, subtracting the starting the start time. Alternatively you can use the ‘Export Log’ action to export the log as XML and use the XML actions to extract the information, you can also use the ‘Export Log’ action to get the build log.

Regards,
Paul.

How do I subtruct the two start and end time values, and get back a duration (or a date-time) type?  Is there a way to define a variable as a date or time type?  I need to output the build time in a time format (e.g. - HH:mm:ss), and not as a number of seconds or number of minutes value.

Hi Hanoch,

The Get DateTime action allows you to subtract a date from the current date or you can use Javascript’s date object using the Run Script action to manipulate the dates.

Regards,
Paul.

It looks like the Get DateTime action only allows to add or subtract individual date/time components like seconds, minutes, hours, days, etc, but not a variable that holds the full date/time structure.

Hi Hanoch,

That’s correct, the action will only allow you to perform basic operations on the date. You’ll need to use script to add or subtract whole dates, here’s the reference I use when working with the Javascript date object:

URL: http://www.w3schools.com/jsref/jsref_obj_date.asp

Let us know if you need help.

Regards,
Paul.

This is not really simple to achieve in Final Builder.  I found I had to use javascript as follows in the OnGetDate method of the Get Date (file) action:

// Note: Variable TimeTestsWereStarted is set by previous action:

// 'Put current date/time into variable' - using format 'ddd, dd, mmm yyyy hh:mm:ss' (this is important).

var finishTime = new Date(ModifiedDate);
var startTime = new Date(TimeTestsWereStarted);
var duration = new Date(finishTime - startTime);

var hours = duration.getUTCHours() + "";
if (hours.length == 1)
{
   hours = "0" + hours;
}

var minutes = duration.getUTCMinutes() + "";
if (minutes.length == 1)
{
   minutes = "0" + minutes;
}

var seconds = duration.getUTCSeconds() + "";
if (seconds.length == 1)
{
   seconds = "0" + seconds;
}

TotalDuration = hours + ":" + minutes + ":" + seconds;

Sorry for waking a zombie thread, but I found this today while searching the same thing. I just used the FinalBuilder “Get DateTime” action for both start and end times, then used the VB Script “Before Action” to calculate the minutes.

DATE_MINUTES_TO_BUILD = DateDiff(“n”,DATE_STARTTIME,DATE_ENDTIME)