Skip to content
YYBartT edited this page Nov 19, 2025 · 2 revisions

Time

Never miss the beat with a simple query to the server for precise time information.

Functions

The following function is provided for working with time:

Structs

Extra details on structs that are returned as time fetching results:



Back To Top

GameJolt_Time

This function queries the time of the Game Jolt server.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

GameJolt_Time(callback_success=undefined, callback_failed=undefined)
Argument Type Description
callback_success Function The callback function executed if the request succeeds
callback_failed Function The callback function executed if the request fails



Returns:

N/A


Triggers:

Success Callback

Triggered when the request succeeds

Key Type Description
time_data TimeData An array holding time data

Failure Callback

Triggered when the request fails

Key Type Description
error_message String The error message

Example:

GameJolt_Time(function(timeData)
    {
        var _timestamp = timeData.timestamp;
        var _timezone = timeData.timezone;
        var _year = timeData.year;
        var _month = timeData.month;
        var _day = timeData.day;
        var _hour = timeData.hour;
        var _minute = timeData.minute;
        var _second = timeData.second;

        if (timeData.hour > 0 && timeDate.hour < 3)
        {
            show_debug_message("It's too late, time to go to sleep!");
        }
    }
);

The code sample above queries the time for the Game Jolt server and if it is too late show a sleeping message.




Back To Top

TimeData

This struct contains details that describe the current time.

This struct is referenced by the following functions:


Member Type Description
timestamp Real The UNIX time stamp (in seconds) representing the server's time
timezone String The timezone of the server (example: "America/New_York")
year Real The current year
month Real The current month
day Real The day of the month
hour Real The hour of the day
minute Real The minute of the hour
second Real The seconds of the minute

Clone this wiki locally