burn / docs

Standard library

std/time

import "time"

var t = new Time(9, 30, 0, 0)
print(t.add(new Time(1, 15, 0, 0)).format())
print(formatTime(3661.0))

Time is a struct with the constructor parameters hours, minutes, seconds and milliseconds.

Function Description
new Time(h, m, s, ms), Time.create(h, m, s, ms), createTime(...) build a time
Time.now() the current local time
Time.fromMilliseconds(ms), Time.fromSeconds(s) from a duration
Time.parse("HH:MM:SS.mmm") parse; the milliseconds part is optional
t.toMilliseconds(), t.toSeconds() as a duration
t.add(other), t.subtract(other) arithmetic
t.format(), t.formatWithMs() HH:MM:SS and HH:MM:SS.mmm
formatTime(seconds), parseTime(text), currentTime() helpers on plain numbers and strings
hoursToMinutes, minutesToHours, hoursToSeconds, secondsToHours, minutesToSeconds, secondsToMinutes, secondsToMs, msToSeconds unit conversions