Gametime to int

From Kolmafia
Jump to navigation Jump to search

Function Syntax

int gametime_to_int()

Returns the current KoL game time using milliseconds since rollover.

Code Sample 1

This code will tell you how many ms it took to list the gCLI commands.

int starttime = gametime_to_int();
CLI_EXECUTE("help");
print("It took "+(gametime_to_int()-starttime)+" ms to list all gCLI commands.");

Code Sample 2

This code will tell you how many ms it has been since KoL's official rollover time.

print("It has been "+gametime_to_int()+" ms since the rollover began.");

Code Sample 3

This code will tell you long since KoL's official rollover time began without hitting the server.

print("It has been "+(gametime_to_int() / (86400000 / 24)) + ":" + ((gametime_to_int() / (86400000 / 1440)) % 60)+" since the rollover began.");

Code Sample 4

This code will tell you how long until KoL's next official rollover time.

print("You have "+(23 - (gametime_to_int() / (86400000 / 24)))+":"+(59 - ((gametime_to_int() / (86400000 / 1440)) % 60))+" left until rollover begins.")


See Also

today_to_string() | gameday_to_int() | gameday_to_string() | time_to_string() | now_to_string()