|
| 1 | +local time = {} |
| 2 | +local duration = {} |
| 3 | +local duration_ops = {} |
| 4 | +local instant = {} |
| 5 | + |
| 6 | +function time.now(): Instant |
| 7 | + error("not implemented") |
| 8 | +end |
| 9 | + |
| 10 | +function time.since(instant: Instant): number |
| 11 | + error("not implemented") |
| 12 | +end |
| 13 | + |
| 14 | +function duration.nanoseconds(nanoseconds: number): Duration |
| 15 | + error("not implemented") |
| 16 | +end |
| 17 | + |
| 18 | +function duration.microseconds(microseconds: number): Duration |
| 19 | + error("not implemented") |
| 20 | +end |
| 21 | + |
| 22 | +function duration.milliseconds(milliseconds: number): Duration |
| 23 | + error("not implemented") |
| 24 | +end |
| 25 | + |
| 26 | +function duration.seconds(seconds: number): Duration |
| 27 | + error("not implemented") |
| 28 | +end |
| 29 | + |
| 30 | +function duration.minutes(minutes: number): Duration |
| 31 | + error("not implemented") |
| 32 | +end |
| 33 | + |
| 34 | +function duration.hours(hours: number): Duration |
| 35 | + error("not implemented") |
| 36 | +end |
| 37 | + |
| 38 | +function duration.days(days: number): Duration |
| 39 | + error("not implemented") |
| 40 | +end |
| 41 | + |
| 42 | +function duration.weeks(weeks: number): Duration |
| 43 | + error("not implemented") |
| 44 | +end |
| 45 | + |
| 46 | +function instant.elapsed(self: Instant): number |
| 47 | + error("not implemented") |
| 48 | +end |
| 49 | + |
| 50 | +function duration_ops.tonanoseconds(self: Duration): number |
| 51 | + error("not implemented") |
| 52 | +end |
| 53 | + |
| 54 | +function duration_ops.tomicroseconds(self: Duration): number |
| 55 | + error("not implemented") |
| 56 | +end |
| 57 | + |
| 58 | +function duration_ops.tomilliseconds(self: Duration): number |
| 59 | + error("not implemented") |
| 60 | +end |
| 61 | + |
| 62 | +function duration_ops.toseconds(self: Duration): number |
| 63 | + error("not implemented") |
| 64 | +end |
| 65 | + |
| 66 | +function duration_ops.tominutes(self: Duration): number |
| 67 | + error("not implemented") |
| 68 | +end |
| 69 | + |
| 70 | +function duration_ops.tohours(self: Duration): number |
| 71 | + error("not implemented") |
| 72 | +end |
| 73 | + |
| 74 | +function duration_ops.todays(self: Duration): number |
| 75 | + error("not implemented") |
| 76 | +end |
| 77 | + |
| 78 | +function duration_ops.toweeks(self: Duration): number |
| 79 | + error("not implemented") |
| 80 | +end |
| 81 | + |
| 82 | +function duration_ops.subsecnanos(self: Duration): number |
| 83 | + error("not implemented") |
| 84 | +end |
| 85 | + |
| 86 | +function duration_ops.subsecmicros(self: Duration): number |
| 87 | + error("not implemented") |
| 88 | +end |
| 89 | + |
| 90 | +function duration_ops.subsecmillis(self: Duration): number |
| 91 | + error("not implemented") |
| 92 | +end |
| 93 | + |
| 94 | +type Frozen = typeof(table.freeze({})) |
| 95 | +export type Duration = setmetatable<Frozen, { |
| 96 | + read __metatable: "The metatable is locked!", |
| 97 | + read __index: typeof(table.freeze(duration_ops)), |
| 98 | + read __add: (Duration, Duration) -> Duration, |
| 99 | + read __sub: (Duration, Duration) -> Duration, |
| 100 | + read __eq: (Duration, Duration) -> boolean, |
| 101 | + read __lt: (Duration, Duration) -> boolean, |
| 102 | + read __le: (Duration, Duration) -> boolean, |
| 103 | +}> |
| 104 | + |
| 105 | +export type Instant = setmetatable<Frozen, { |
| 106 | + read __metatable: "The metatable is locked!", |
| 107 | + read __index: typeof(table.freeze(instant)), |
| 108 | + read __sub: (Instant, Instant) -> Duration, |
| 109 | +}> |
| 110 | + |
| 111 | +time.duration = duration |
| 112 | +return time |
0 commit comments