Click here to Skip to main content
15,667,077 members
Articles / Programming Languages / C++
Posted 1 Oct 2001


9 bookmarked

Build Duration Macro

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
1 Oct 2001
A DevStudio macro that displays the project's build duration


This macro adds a missing feature to DevStudio6. It displays project build duration. You'll see a new tab named Macro in the output window (next to the standard tabs: Build, Debug, Find in files...)

Open your macro file and insert the following line before any other functions or subroutines.

Public dBuildStartTime

Next, place the code below somewhere in your macro file. These events (Application_BeforeBuildStart and Application_BuildFinish) will be automatically triggered by DevStudio when you build your projects.

Sub Application_BeforeBuildStart()
	' keep the build-starting time
	dBuildStartTime = Now
	Application.PrintToOutputWindow " "
	Application.PrintToOutputWindow "--------------------------------"
	Application.PrintToOutputWindow "Build start: " & dBuildStartTime
End Sub

Sub Application_BuildFinish(nNumErrors, nNumWarnings)
	' get build time
	dNow = Now

	sec = DateDiff("s", dBuildStartTime, dNow)

	hours = sec \ 3600
	sec = sec - hours * 3600

	min = sec \ 60
	sec = sec - min * 60

	' format
	Dim strH, strM, strS

	If hours > 10 Then
		strH = hours
		strH = "0" & hours
	End If

	If min > 10 Then
		strM = min
		strM = "0" & min
	End If

	If sec > 10 Then
		strS = sec
		strS = "0" & sec
	End If

	' display
	Application.PrintToOutputWindow "Build end:   " & dNow
	Application.PrintToOutputWindow "Build time:  " & strH & ":" & strM & ":" & strS
	Application.PrintToOutputWindow nNumWarnings & " warning(s), " & nNumErrors & " error(s)."

End Sub


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

GeneralDevStudio6 has this option Pin
2-Oct-01 2:53
suss2-Oct-01 2:53 
GeneralRe: DevStudio6 has this option Pin
2-Oct-01 23:14
suss2-Oct-01 23:14 
Well, I didn't know that Cry | :((
It seems that my macro is useless then... Big Grin | :-D
GeneralRe: DevStudio6 has this option Pin
Philippe Lhoste9-Oct-01 1:24
Philippe Lhoste9-Oct-01 1:24 
GeneralRe: DevStudio6 has this option Pin
Jack Hendriks8-Oct-01 20:03
Jack Hendriks8-Oct-01 20:03 
GeneralRe: DevStudio6 has this option Pin
8-Oct-01 21:31
suss8-Oct-01 21:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.