Stop Stopwatch
Verb: stopTimer
Available from: <Standard>
Stops the elapsed time count of an interval in the script, returning the total accounted time.
Syntax
stopTimer --stopwatch(Stopwatch) (TimeSpan)=time (Numeric)=days (Numeric)=hours (Numeric)=minutes (Numeric)=seconds (Numeric)=milliseconds
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--stopwatch | Stopwatch | Required | Stopwatch | Receives the variable where the counting was started by the Start Stopwatch command to end the counting. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
time | Time | Time Span | Total amount of time that has been accounted for. |
days | Total days | Number | Total amount of time counted in number of days. |
hours | Total hours | Number | Total amount of time counted in number of hours. |
minutes | Total minutes | Number | Total amount of time counted in number of minutes. |
seconds | Total seconds | Number | Total amount of time counted in number of seconds. |
milliseconds | Total milliseconds | Number | Total amount of time counted in number of milliseconds. |
Example
Stops the time count that a For loop took to execute and counts this total time in days, hours, minutes, seconds, and milliseconds, respectively.
defVar --name stopwatch --type Stopwatch
defVar --name runtime --type TimeSpan
defVar --name loopBegin --type Numeric --value 1
defVar --name loopEnd --type Numeric --value 999
defVar --name sum --type Numeric --value 1
defVar --name timedDays --type Numeric
defVar --name timedHours --type Numeric
defVar --name timedMinutes --type Numeric
defVar --name timedSeconds --type Numeric
defVar --name timedMilliseconds --type Numeric
startTimer stopwatch=value
for --variable ${loopBegin} --from ${loopBegin} --to ${loopEnd} --step 1
incrementVar --number ${sum}
next
stopTimer --stopwatch ${stopWatch} runtime=time timedDays=days timedHours=hours timedMinutes=minutes timedSeconds=seconds timedMilliseconds=milliseconds
logMessage --message "sum: ${sum}\r\ndays: ${timedDays}\r\nhours: ${timedHours}\r\nminutes: ${timedMinutes}\r\nseconds: ${timedSeconds}\r\nmilliseconds: ${timedMilliseconds}\r\ntotal runtime: ${runtime}" --type "Info"
// The example displays the resulting sum of iterations of the loop executed: 1000.
// Displays the total time in days, hours, minutes, seconds, milliseconds and total runtime, respectively.
Remarks
The Stopwatch parameter receives only one time count at a time, and you must use one Stop Stopwatch command for each Start Stopwatch command used.