ManiaScript Trackmania 2020  30/10/2024
TimeLib Namespace Reference

Standard time manipulation functions. More...

Enumerations

enum  EDateFormats {
  Full, Date, DateCompact, DateShort,
  Time, TimeShort, Relative, RelativeShort,
  MonthYear
}
 
enum  EDurationFormats { Full, Abbreviated, Chrono }
 

Functions

Text FormatDate (Text _Timestamp, EDateFormats _Format)
 Returns the date corresponding to a timestamp, formatted according to the locale. Not available on servers. More...
 
Text FormatDelta (Text _Timestamp1, Text _Timestamp2, EDurationFormats _Format)
 Returns the duration between 2 timestamps, formatted according to the locale. Not available on servers. More...
 
Text FormatDelta (Text _Delta, EDurationFormats _Format)
 Returns the duration Delta formatted according to the locale. Not available on servers. More...
 
Integer Compare (Text _Timestamp1, Text _Timestamp2)
 Compares 2 timestamps. More...
 
Real Clamp01 (Text _Boundary1, Text _Boundary2, Text _Timestamp)
 Returns a Real between 0 and 1, given an interval and a timestamp. More...
 
Real Clamp01TZDay (Text _Timestamp)
 Returns a Real between 0 and 1, given a timestamp, according to the day cycle in local timezone. More...
 
Real Clamp01UTCDay (Text _Timestamp)
 Returns a Real between 0 and 1, given a timestamp, according to the day cycle in UTC timezone. More...
 
Text GetCurrent ()
 Gets current timestamp. More...
 
Integer GetDelta (Text _Timestamp1, Text _Timestamp2)
 Returns the duration in seconds between 2 timestamps. May be clamped if huge. More...
 
Integer GetLocalDelta_Years (Text _Timestamp1, Text _Timestamp2)
 Returns the duration in complete years between 2 timestamps, according to the local dates. More...
 
Integer GetLocalDelta_Months (Text _Timestamp1, Text _Timestamp2)
 Returns the duration in complete months between 2 timestamps, according to the local dates. More...
 
Integer GetMillisecondsSinceInit ()
 Returns local milliseconds elapsed since game initialisation. More...
 

Detailed Description

Standard time manipulation functions.

Enumeration Type Documentation

◆ EDateFormats

Enumerator
Full 
Date 
DateCompact 
DateShort 
Time 
TimeShort 
Relative 
RelativeShort 
MonthYear 

Definition at line 22362 of file 2024_10_30.h.

22362  {
22363  Full,
22364  Date,
22365  DateCompact,
22366  DateShort,
22367  Time,
22368  TimeShort,
22369  Relative,
22370  RelativeShort,
22371  MonthYear,
22372  };

◆ EDurationFormats

Enumerator
Full 
Abbreviated 
Chrono 

Definition at line 22376 of file 2024_10_30.h.

22376  {
22377  Full,
22378  Abbreviated,
22379  Chrono,
22380  };

Function Documentation

◆ Clamp01()

Real TimeLib::Clamp01 ( Text  _Boundary1,
Text  _Boundary2,
Text  _Timestamp 
)

Returns a Real between 0 and 1, given an interval and a timestamp.

Parameters
_Boundary1: Lower boundary defining the time interval
_Boundary2: Higher boundary defining the time interval
_Timestamp: Timestamp to check

◆ Clamp01TZDay()

Real TimeLib::Clamp01TZDay ( Text  _Timestamp)

Returns a Real between 0 and 1, given a timestamp, according to the day cycle in local timezone.

Parameters
_Timestamp: Timestamp to check

◆ Clamp01UTCDay()

Real TimeLib::Clamp01UTCDay ( Text  _Timestamp)

Returns a Real between 0 and 1, given a timestamp, according to the day cycle in UTC timezone.

Parameters
_Timestamp: Timestamp to check

◆ Compare()

Integer TimeLib::Compare ( Text  _Timestamp1,
Text  _Timestamp2 
)

Compares 2 timestamps.

Parameters
_Timestamp1: Unix timestamp
_Timestamp2: Unix timestamp

◆ FormatDate()

Text TimeLib::FormatDate ( Text  _Timestamp,
EDateFormats  _Format 
)

Returns the date corresponding to a timestamp, formatted according to the locale. Not available on servers.

Parameters
_Timestamp: Timestamp to format
_Format: Format

◆ FormatDelta() [1/2]

Text TimeLib::FormatDelta ( Text  _Delta,
EDurationFormats  _Format 
)

Returns the duration Delta formatted according to the locale. Not available on servers.

Parameters
_Delta: Delta in seconds
_Format: Format

◆ FormatDelta() [2/2]

Text TimeLib::FormatDelta ( Text  _Timestamp1,
Text  _Timestamp2,
EDurationFormats  _Format 
)

Returns the duration between 2 timestamps, formatted according to the locale. Not available on servers.

Parameters
_Timestamp1: Timestamp1
_Timestamp2: Timestamp2
_Format: Format

◆ GetCurrent()

Text TimeLib::GetCurrent ( )

Gets current timestamp.

◆ GetDelta()

Integer TimeLib::GetDelta ( Text  _Timestamp1,
Text  _Timestamp2 
)

Returns the duration in seconds between 2 timestamps. May be clamped if huge.

Parameters
_Timestamp1: First timestamp. Result will be positive if this one is bigger/more recent
_Timestamp2: Second timestamp

◆ GetLocalDelta_Months()

Integer TimeLib::GetLocalDelta_Months ( Text  _Timestamp1,
Text  _Timestamp2 
)

Returns the duration in complete months between 2 timestamps, according to the local dates.

Parameters
_Timestamp1: First timestamp. Result will be positive if this one is bigger/more recent
_Timestamp2: Second timestamp

◆ GetLocalDelta_Years()

Integer TimeLib::GetLocalDelta_Years ( Text  _Timestamp1,
Text  _Timestamp2 
)

Returns the duration in complete years between 2 timestamps, according to the local dates.

Parameters
_Timestamp1: First timestamp. Result will be positive if this one is bigger/more recent
_Timestamp2: Second timestamp

◆ GetMillisecondsSinceInit()

Integer TimeLib::GetMillisecondsSinceInit ( )

Returns local milliseconds elapsed since game initialisation.

TimeLib::RelativeShort
@ RelativeShort
Definition: 2024_10_30.h:22370
TimeLib::Abbreviated
@ Abbreviated
Definition: 2024_10_30.h:22378
TimeLib::Full
@ Full
Definition: 2024_10_30.h:22363
TimeLib::DateShort
@ DateShort
Definition: 2024_10_30.h:22366
TimeLib::DateCompact
@ DateCompact
Definition: 2024_10_30.h:22365
TimeLib::MonthYear
@ MonthYear
Definition: 2024_10_30.h:22371
TimeLib::Date
@ Date
Definition: 2024_10_30.h:22364
TimeLib::TimeShort
@ TimeShort
Definition: 2024_10_30.h:22368
TimeLib::Chrono
@ Chrono
Definition: 2024_10_30.h:22379
TimeLib::Time
@ Time
Definition: 2024_10_30.h:22367
TimeLib::Relative
@ Relative
Definition: 2024_10_30.h:22369