Skip to content
TimeReferenceNew · 0.744

Stopwatch:Stop

Stop measuring and keep the accumulated time.

Details#

Adds the current running interval to the accumulated total and stops the stopwatch. Calling Stop while already stopped has no effect. ElapsedTime stays constant while stopped. Calling Start again resumes accumulation without clearing the saved total.

Fields Stopwatch#

FieldTypeMeaning
IsRunningbooleanTrue while the stopwatch is running; false after construction, Stop or Reset.
ElapsedTimeDurationAccumulated elapsed time, including the current interval while running. Each read returns a duration value; read again for a fresh measurement.

Signature#

Luau
watch:Stop(): ()

Returns#

No return values. Instance methods require a Stopwatch receiver.

Examples#

Local example

Luau
local watch = Stopwatch.new()
watch:Start()
-- Perform your local work here.
watch:Stop()
local measured = watch.ElapsedTime
print(measured.Milliseconds)

Notes#

  • ElapsedTime is a Duration: read .Seconds, .Milliseconds or another duration field. A saved ElapsedTime value does not update itself.