Elpho LogoElpho

time module

Time helpers for timestamps, durations, and relative strings.

Overview

Use time to get current moments, format ISO strings, and compute differences. Great for latency or cooldown messages.

API

  • now() → ms timestamp.
  • iso() → ISO string for current time.
  • relative(ms) → human-ish relative string.
  • diff(start, end) → difference in ms.
All times are UTC; no timezone helpers.

Examples

javascript
const time = use("time");
function main() {
const start = time.now();
// pretend work
const elapsed = time.diff(start, time.now());
ctx.reply("Elapsed: " + elapsed + "ms");
}
javascript
const time = use("time");
function main() {
ctx.reply("Now: " + time.iso());
}