GSDate Class Reference

Class that handles all date related (calculation) functions. More...


Static Public Member Functions

static int32 GetCurrentDate ()
 Get the current date.
static int32 GetYear (int32 date)
 Get the year of the given date.
static int32 GetMonth (int32 date)
 Get the month of the given date.
static int32 GetDayOfMonth (int32 date)
 Get the day (of the month) of the given date.
static int32 GetDate (int32 year, int32 month, int32 day_of_month)
 Get the date given a year, month and day of month.
static int32 GetSystemTime ()
 Get the time of the host system.


Detailed Description

Class that handles all date related (calculation) functions.

Note:
Months and days of month are 1-based; the first month of the year is 1 and the first day of the month is also 1.

Years are zero based; they start with the year 0.

Dates can be used to determine the number of days between two different moments in time because they count the number of days since the year 0.


Member Function Documentation

static int32 GSDate::GetCurrentDate (  )  [static]

Get the current date.

This is the number of days since epoch under the assumption that there is a leap year every 4 years, except when dividable by 100 but not by 400.

Returns:
The current date.

static int32 GSDate::GetYear ( int32  date  )  [static]

Get the year of the given date.

Parameters:
date The date to get the year of.
Returns:
The year.

static int32 GSDate::GetMonth ( int32  date  )  [static]

Get the month of the given date.

Parameters:
date The date to get the month of.
Returns:
The month.

static int32 GSDate::GetDayOfMonth ( int32  date  )  [static]

Get the day (of the month) of the given date.

Parameters:
date The date to get the day of.
Returns:
The day.

static int32 GSDate::GetDate ( int32  year,
int32  month,
int32  day_of_month 
) [static]

Get the date given a year, month and day of month.

Parameters:
year The year of the to-be determined date.
month The month of the to-be determined date.
day_of_month The day of month of the to-be determined date.
Returns:
The date.

static int32 GSDate::GetSystemTime (  )  [static]

Get the time of the host system.

Returns:
The amount of seconds passed since 1 Jan 1970.
Note:
This uses the clock of the host system, which can skew or be set back. Use with caution.


Generated on Sun Mar 31 21:37:40 2013 for OpenTTD Game API by  doxygen 1.5.6