Skip to content

Time ​

com.jsmacrosce.jsmacros.core.library.impl.FTime

Provides wall-clock time utilities to scripts as Time.

time() returns system time in milliseconds since the Unix epoch; sleep(long) waits in milliseconds rather than game ticks. In the Graal context, sleeping yields execution to other script threads while the calling script waits.

js
const started = Time.time();  
Time.sleep(1000);  
print(`that took about ${Time.time() - started} ms`);

Accessible in scripts via the global Time variable.

Methods ​

sleep ​

sleep(long millis): void#
Waits for the specified wall-clock duration; this is not a tick-based delay. In the Graal context, the language engine is yielded to other script threads while waiting. Closing the script context can interrupt a sleeping bound thread.

Parameters:

  • millis: how long to sleep for, in milliseconds

time ​

time(): long#
Returns: milliseconds since the Unix epoch, from the system wall clock