Remark: This function is equivalent to the Value property of Chrono variables.

New in version 24

Remark: This function is equivalent to the Value property of Chrono variables.

Remark: This function is equivalent to the Value property of Chrono variables.

Versions 17 and later

This function is now available for iPhone/iPad applications.

New in version 17

This function is now available for iPhone/iPad applications.

This function is now available for iPhone/iPad applications.

Versions 18 and later

This function is now available in Android Widget mode.

This function is now available in Windows Store apps mode.

New in version 18

This function is now available in Android Widget mode.

This function is now available in Windows Store apps mode.

This function is now available in Android Widget mode.

This function is now available in Windows Store apps mode.

Versions 21 and later

This function is now available in Apple Watch mode.

This function is now available in Universal Windows 10 App mode.

New in version 21

This function is now available in Apple Watch mode.

This function is now available in Universal Windows 10 App mode.

This function is now available in Apple Watch mode.

This function is now available in Universal Windows 10 App mode.

Versions 25 and later

This function is now available in browser code.

New in version 25

This function is now available in browser code.

This function is now available in browser code.

Example

DurationMyFunction1 is int DurationMyFunction2 is int TotalDuration is int // Start the stopwatch ChronoStart() MyFunction1() DurationMyFunction1 = ChronoEnd() Info("The MyFunction1() process lasted " + DurationMyFunction1 + " milliseconds")

TotalDuration = DurationMyFunction1 + DurationMyFunction2 Info("The total process lasted " + TotalDuration + " milliseconds")

Versions 24 and later

DurationMyFunction1 is int TotalDuration is int MyChrono is Chrono // Start the stopwatch ChronoStart(MyChrono) MyFunction1() DurationMyFunction1 = ChronoValue(MyChrono) Trace("The MyFunction1() process lasted " + DurationMyFunction1 + " milliseconds")

MyFunction2() TotalDuration = ChronoEnd(MyChrono) Trace("The total process lasted (including the display) " + TotalDuration + " milliseconds")

New in version 24

DurationMyFunction1 is int TotalDuration is int MyChrono is Chrono // Start the stopwatch ChronoStart(MyChrono) MyFunction1() DurationMyFunction1 = ChronoValue(MyChrono) Trace("The MyFunction1() process lasted " + DurationMyFunction1 + " milliseconds")

MyFunction2() TotalDuration = ChronoEnd(MyChrono) Trace("The total process lasted (including the display) " + TotalDuration + " milliseconds")

DurationMyFunction1 is int TotalDuration is int MyChrono is Chrono // Start the stopwatch ChronoStart(MyChrono) MyFunction1() DurationMyFunction1 = ChronoValue(MyChrono) Trace("The MyFunction1() process lasted " + DurationMyFunction1 + " milliseconds")

MyFunction2() TotalDuration = ChronoEnd(MyChrono) Trace("The total process lasted (including the display) " + TotalDuration + " milliseconds")

Syntax

Indicating the value of a timing started with a stopwatch number Hide the details

<Result> = ChronoValue([<Stopwatch number>])

<Result>: Duration

Time elapsed (in milliseconds) since the last call to ChronoStart for the specified stopwatch number.

This parameter is an integer.

<Stopwatch number>: Optional integer

Identifier of stopwatch used. If this parameter is not specified, its default value is set to 1.

Versions 24 and later

Indicating the value of a timing started with a Chrono variable Hide the details

<Result> = ChronoValue(<Stopwatch>)

<Result>: Duration

Time elapsed (in milliseconds) since the last call to ChronoStart for the specified stopwatch.

<Stopwatch>: Chrono variable

Name of the Chrono variable that corresponds to the stopwatch to use.

New in version 24

Indicating the value of a timing started with a Chrono variable Hide the details

<Result> = ChronoValue(<Stopwatch>)

<Result>: Duration

Time elapsed (in milliseconds) since the last call to ChronoStart for the specified stopwatch.

<Stopwatch>: Chrono variable

Name of the Chrono variable that corresponds to the stopwatch to use.

Indicating the value of a timing started with a Chrono variable Hide the details

<Result> = ChronoValue(<Stopwatch>)

<Result>: Duration

Time elapsed (in milliseconds) since the last call to ChronoStart for the specified stopwatch.

<Stopwatch>: Chrono variable

Name of the Chrono variable that corresponds to the stopwatch to use.

Remarks

Miscellaneous

After calling ChronoEnd, all the calls to ChronoValue will return the value of the stopwatch when ChronoEnd was called.

Error

A WLanguage error occurs ("The stopwatch is not started") if ChronoStart was not called before ChronoValue.

Threads and parallel tasks

Each thread (and each parallel task) includes its own stopwatches.

Two distinct threads (or two distinct parallel tasks) can perform separate timings by using the same stopwatch number.

The WLanguage error "The stopwatch is not started" will occur only if ChronoStart and ChronoValue are not called in the same thread.

Related Examples:

Unit examples (WINDEV): Calculations on durations

[ + ] Calculations on dates and times with the WLanguage functions: - Calculate the duration between two moments (dates and times) - Calculate a sum of durations - Calculate an average of durations