Skip to content
Francisco Dias edited this page Jan 30, 2023 · 3 revisions

Back To Top

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:

  • TimeData




Back To Top

This function queries the time of the Game Jolt server. This is an asynchronous function that will trigger either the callback_success method (if task is successful) or the callback_failed method (if task fails).


Syntax:

GameJolt_Time([callback_success], [callback_failed])
Argument Type Description
callback_success method The callback function executed if the request succeeds (a TimeData struct is passed as argument) ✴️ OPTIONAL
callback_failed method The callback function executed if the request fails (error message is passed as argument) ✴️ OPTIONAL

Returns:

N/A

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.




Clone this wiki locally