You are currently viewing the gmlscripts.pro static mirror. Forum access and script submissions are not available through this mirror.

Invert gmlscripts.pro

unix_timestamp

Download
unix_timestamp([datetime])
Returns a Unix timestamp for the current time or optionally given GameMaker datetime value.
COPY/// unix_timestamp([datetime])
//
//  Returns a Unix timestamp for the current time
//  or optionally given GameMaker datetime value.
//
//      datetime    GameMaker datetime, real
//
/// gmlscripts.pro/license
{
    var timezone = date_get_timezone();

    date_set_timezone(timezone_utc);

    if (argument_count > 0) {
        var datetime = argument[0];
    } else {
        var datetime = date_current_datetime();
    }

    var timestamp = round(date_second_span(25569, datetime));

    date_set_timezone(timezone);

    return timestamp;
}

Contributors: xot

GitHub: View · Commits · Blame · Raw