EMILUA(3em)

πŸ“¦ version 0.12.1, in nixos 26.05, nixpkgs unstable

πŸ’… 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