Skip to content

world.getClock

Returns the time on the shared game clock. It runs one game minute per real second.

Renamed in 0.28 from world.clock; see renamed names.

world.getClock(): { hours: number; minutes: number }

None.

{ hours, minutes }: 0 to 23 and 0 to 59, run on from the server’s last report.

gamemodes/my-mode.ts
import { chat, commands, world } from "nativemp";
commands.register("time", (player) => {
const { hours, minutes } = world.getClock();
chat.sendServerMessage(`It's ${hours}:${String(minutes).padStart(2, "0")}.`, player);
});