Timeutils

Package that handles ingame and real world time.

Including Code

Все функции отвечающие за вывод времени в игре.

include ":timeutils:gameTime";

CONST

enum TIME_UNITS
	// Base unit: Millisecond
	MIL_SECOND	:= 1000,
	MIL_MINUTE	:= MIL_SECOND * 60,
	MIL_HOUR	:= MIL_MINUTE * 60,
	MIL_DAY		:= MIL_HOUR * 24,
	MIL_WEEK	:= MIL_DAY * 7,
	MIL_MONTH	:= MIL_DAY * 30,
	MIL_YEAR	:= MIL_MONTH * 12,

	// Base unit: Second
	SEC_MINUTE  	:= 60,
	SEC_HOUR	:= SEC_MINUTE * 60,
	SEC_DAY	 	:= SEC_HOUR * 24,
	SEC_WEEK	:= SEC_DAY * 7,
	SEC_MONTH	:= SEC_DAY * 30,
	SEC_YEAR	:= SEC_DAY * 365,

	// SleepMs value to prevent RunAway
	NO_RUNAWAY  := 10
endenum

GetTime()

Returns current UNIX time stamp. Example: 1609429618

Unix timestamp - это способ отслеживать время в течение нескольких секунд. Этот отсчет начинается в эпоху Unix 1 января 1970 года в UTC году. Таким образом, это всего лишь число секунд между определенной датой и Unix-й эпохой

GetTimeStruct(time)

Returns current time as struct: day, month, year, hour, minute, second

FormatTime(byref time_struct, format)

Returns a formatted time string.

Parameters

Description

time_struct:

The time struct to use as base

format:

The format string. The following tags will be expanded:

  • <Y>: Year

  • <M>: Month name, <m>: Month number

  • <d>: Day number

  • <h>: Hour, <i>: Minute, <s>: Second

Month

GetMonthName(month)

Convert the month number to the month's abbreviated name.

GetMonthFullName(month)

Convert the month number to the month's name.

GetMonthOrdinal(month)

Convert the month's name or abbreviation to the ordinal number of the month.

GetMonthLength(month, year := 0)

Returns the length of the month in days

GetMonthDifferential( byref current_month, byref previous_month )

Returns the difference between month_1 and month_2 The intended use of this function is to determine the number of months that have elapsed between current_month and previous_month.

Other

IsLeap()

Returns whether a year is a leap year or not.

GetCurrentPlaytimeMonth()

Возвращает текущий месяц формата: 2017_april_play_time для Statictics

Last updated

Was this helpful?