Help / WLanguage / WLanguage functions / Standard functions / Date and time functions
  • Error
  • Threads and parallel tasks
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Starts a stopwatch to measure the duration of a process (in milliseconds) and resets a running stopwatch. The timing is stopped: If timing is stopped, it can be restarted with <Chrono>.Resume.
The value of the stopwatch can be read at any time:
MyChrono1 is Chrono
MyChrono2 is Chrono
// Start the first stopwatch
// Start the second stopwatch
// Stop the first stopwatch
DurationChronoStart is Duration = MyChrono1.End()
// Stop the second stopwatch
DurationChronoStart is Duration = MyChrono2.End()
Info("The MyFunction() process lasted " + DurationMyFunction, ...
"The whole process lasted " + DurationChronoStart)

Timing with a Chrono variable Hide the details

<Stopwatch>: Chrono variable
Name of the Chrono variable that corresponds to the stopwatch to use.


A WLanguage error occurs ("The stopwatch is not started") if <Chrono>.Start was not called before ChronoValue and <Chrono>.End.

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 <Chrono>.Start is not called in the same thread (or in the same parallel task) as ChronoValue and <Chrono>.End.
Related Examples:
The Chrono functions Unit examples (WINDEV): The Chrono functions
[ + ] Using the ChronoXXX functions.
These functions are used to calculate the time passed between the start (ChronoStart) and the end (ChronoEnd).
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
The Chrono functions Unit examples (WINDEV Mobile): The Chrono functions
[ + ] Using the WLanguage "Chrono" functions.
These functions are used to calculate the time passed between the start (ChronoStart) and the end (ChronoEnd).
UWA Stopwatch Universal Apps (WINDEV Mobile): UWA Stopwatch
[ + ] This example explains how to create a stopwatch for a mobile device with WINDEV Mobile.
In this example, a timer is used to display the hands of the stopwatch and to display the time passed on a regular basis.
Component: wd290vm.dll
Minimum version required
  • Version 24
This page is also available for…
Click [Add] to post a comment

Last update: 11/27/2023

Send a report | Local help