Skip to content

duration

luau
local duration = require("@std/time/duration")

WARNING

These APIs are still open to future evolution. In new major versions, they may change in backwards incompatible ways.

Summary

EntryDescription
DurationA span of time.
createCreates a Duration from a number of seconds and an additional number of nanoseconds, subsecnanos.
daysCreates a Duration from a number of days.
hoursCreates a Duration from a number of hours.
microsecondsCreates a Duration from a number of microseconds.
millisecondsCreates a Duration from a number of milliseconds.
minutesCreates a Duration from a number of minutes.
nanosecondsCreates a Duration from a number of nanoseconds.
secondsCreates a Duration from a number of seconds.
weeksCreates a Duration from a number of weeks.

Types

Duration

A span of time.

luau
type Duration = time.Duration

Functions and Properties

duration.create

Creates a Duration from a number of seconds and an additional number of nanoseconds, subsecnanos.

luau
(seconds: number, subsecnanos: number) -> Duration

duration.days

Creates a Duration from a number of days.

luau
(days: number) -> Duration

duration.hours

Creates a Duration from a number of hours.

luau
(hours: number) -> Duration

duration.microseconds

Creates a Duration from a number of microseconds.

luau
(microseconds: number) -> Duration

duration.milliseconds

Creates a Duration from a number of milliseconds.

luau
(milliseconds: number) -> Duration

duration.minutes

Creates a Duration from a number of minutes.

luau
(minutes: number) -> Duration

duration.nanoseconds

Creates a Duration from a number of nanoseconds.

luau
(nanoseconds: number) -> Duration

duration.seconds

Creates a Duration from a number of seconds.

luau
(seconds: number) -> Duration

duration.weeks

Creates a Duration from a number of weeks.

luau
(weeks: number) -> Duration