ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Date and time functions
  • Miscellaneous
  • Error
  • Threads and parallel tasks
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Indicates the time elapsed (in milliseconds) since the call to ChronoStart. The stopwatch is not stopped.
To stop the stopwatch, use ChronoEnd.
Note: This function is equivalent to the property value for variables of type Chrono..
PHP Variables of type Chrono are not available.
New in version 2025
WEBDEV - Browser code Variables of type Chrono are now available in browser code. The syntax for handling Chrono variables also becomes available.
Example
DuréeMaFonction1 is int
DuréeMaFonction2 is int 
DuréeTotale is int
// Démarrage du chronomètre
ChronoStart()
MaFonction1()
DuréeMaFonction1 = ChronoEnd()
Info("Le traitement MaFonction1() a duré " + DuréeMaFonction1 + " millisecondes")

ChronoStart()
MaFonction2()
DuréeMaFonction2 = ChronoEnd()
Info("Le traitement MaFonction2() a duré " + DuréeMaFonction2 + " millisecondes")

DuréeTotale = DuréeMaFonction1 + DuréeMaFonction2
Info("Le traitement total a duré " + DuréeTotale + " millisecondes")
WEBDEV - Browser codeReports and QueriesWindowsLinuxAndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystJavaUser code (UMC)
DuréeMaFonction1 is int 
DuréeTotale is int
MonChrono is Chrono
// Démarrage du chronomètre
ChronoStart(MonChrono)
MaFonction1()
DuréeMaFonction1 = ChronoValue(MonChrono)
Trace("Le traitement MaFontion1() a duré " + DuréeMaFonction1 + " millisecondes")

MaFonction2()
DuréeTotale = ChronoEnd(MonChrono)
Trace("Le traitement total a duré (y compris affichage) " + DuréeTotale + " millisecondes")
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.
PHP 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.
PHP This syntax is not available in PHP

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:
Calculations on durations 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
Business / UI classification: Neutral code
Component: wd300vm.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/19/2024

Send a report | Local help