Skip to content

Date Time API

Nenkai edited this page Jul 14, 2024 · 3 revisions

Warning

This API was introduced after GT4.

< MTime Reference Class >

Get Current Time

var time = pdistd::MTime::getCurrentTime();
var year = time.year;
var month = time.month;
var day = time.day;
var hour = time.hour;
var minute = time.minute;
var second = time.second;

Create DateTime object

var datetime = pdistd::MTime();

// Setting by amount of seconds
datetime.setBySecond(60);

// Setting by amount of minutes
datetime.setBySecond(1);

// Creating using specified utc string
var datetime2 = pdistd::MTime("2024/01/01 12:00:00");

Get Current System Time (microseconds)

var us = pdistd::GetSystemTimeMicroSecond();

Get Server Time (when online)

var serverTime = pdiext::getBetterTime();

Race Date Times String

var time_str = pdiext::GetDateTimeString(sec); // 29/12/2022 03:28'44
var time_str_short = pdiext::GetDateTimeStringShort(sec); // 29/12/2022 03:29
var race_time_str = pdiext::GetRaceTimeString(ms); // 0:00.001

Race Diff Time String

var diff_str = pdiext::GetDiffTimeString(sec); // +00.200, +00.000, -00.200,'
var unk = pdiext::GetDiffTimeString(pdiext::MAX_LAPTIME1000);
Clone this wiki locally