EMILUA(3em)
π EMILUA (3em) π
okay so bestie, welcome to Emilua β the Lua execution engine β and today we're doing a lil deep dive on the system clock module β¨ no cap, it's lowkey iconic.
πΈ DESCRIPTION πΈ
fr fr, here's the whole vibe in one snippet:
local clock = require('time').system_clock
local timepoint = clock.now()
This is the system-wide real time wall clock π°οΈ β it uses the UNIX epoch, periodt.
β οΈ Note: on most systems, the system time can be adjusted at any moment π like literally whenever, so don't come for me if your clock does a lil cha-cha.
β¨ FUNCTIONS β¨
now() β system_clock.time_pointβ gives you a brand new time point that's the current value of the clock π«Ά she's giving right now energy.epoch() β system_clock.time_pointβ gives you a fresh time point representing the epoch of the clock π the origin story, iykyk.
π¦ time_point FUNCTIONS π¦
add(self, secs: number)β modifies the time point by the given duration β³ slay.
β οΈ Note: when the duration gets converted to the native tick representation of the clock, it'll be rounded to the nearest time point, rounding to even in halfway cases. that rounding-to-even thing is real, bestie, don't sleep on it π
sub(self, secs: number)β modifies the time point by the given duration π same deal.
β οΈ Note: when the duration gets converted to the native tick representation of the clock, it'll be rounded to the nearest time point, rounding to even in halfway cases. yes, same note, she's consistent π
π time_point PROPERTIES π
seconds_since_epoch: numberβ the number of elapsed seconds since 1 January 1970, and it does not count leap seconds π that's the whole property, no extras.
π₯ time_point METAMETHODS π₯
the girls that get it, get it π here's the full roster:
__add()__sub()__eq()__lt()__le()
and that's the whole page, bestie π go forth and tell time responsibly π
<div align="center">π§ Emilua 0.12.1-nixpkgs1, dated 1980-01-01 β mwah, kiss kiss, bye bye π§</div>
π¦ where this page comes from
- nixos 26.05: emilua 0.12.1
- nixpkgs unstable: emilua 0.12.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms