Time

Real Date Utils

class CommonRealDateUtils

Bases: object

A utility for managing real life date and time.

Note

This utility is used to handle the Real Time and not the Game Time.

static get_current_date_string()

Retrieve the current date as a pre-formatted string.

Returns:The string representation of the current real date.
Return type:str

Time Utils

class CommonTimeUtils

Bases: object

Utilities for handling the in-game Time.

static advance_current_time(hours=0, minutes=0, seconds=0)

Advance the current time by the specified amounts.

Parameters:
  • hours (int, optional) – The number of hours to advance.
  • minutes (int, optional) – The number of minutes to advance.
  • seconds (int, optional) – The number of seconds to advance.
static game_is_paused()

Determine if the game is paused.

Returns:True, if the game is paused. False, if not.
Return type:bool
static game_is_running_at_speed(clock_speed)

Determine if the game is running at the specified speed.

Parameters:clock_speed (ClockSpeedMode) – The speed to change the game time to.
Returns:True, if the game is running at the specified speed. False, if not.
Return type:bool
static get_clock_speed()

Retrieve the current clock speed.

Returns:The current speed of the game clock.
Return type:ClockSpeedMode
static get_clock_speed_scale()

Retrieve the current clock speed multiplier.

Returns:The current speed multiplier of the game clock.
Return type:ClockSpeedMultiplierType
static get_current_date_and_time()

Retrieve the current date and time.

Returns:The current date and time.
Return type:DateAndTime
static get_current_hour()

Retrieve the current sim hour.

Returns:The current hour of the day.
Return type:int
static get_current_minute()

Retrieve the current sim minute.

Returns:The current minute of the hour.
Return type:int
static get_current_second()

Retrieve the current sim second.

Returns:The current second of the minute.
Return type:int
static get_day_of_week()

Retrieve the current day of the week.

Returns:The current day of the week. 0-6
Return type:int
static get_game_clock()

Get an instance of the GameClock.

Returns:An instance of the game clock.
Return type:GameClock
static get_time_service()

Get an instance of the TimeService.

Returns:An instance of the Time Service.
Return type:TimeService
static get_total_days()

Retrieve the total sim days since the start of the game.

Returns:The total number of days since the start of the game.
Return type:int
static get_total_hours()

Retrieve the total sim hours since the start of the game.

Returns:The total number of hours since the start of the game.
Return type:int
static get_total_ticks()

Retrieve the total sim ticks since the start of the game.

Returns:The total number of ticks in milliseconds since the start of the game.
Return type:int
static get_total_weeks()

Retrieve the total sim weeks since the start of the game.

Returns:The total number of weeks since the start of the game.
Return type:int
static is_day_time()

Determine if it is currently Day Time.

Returns:True, if it is day time. False, if not.
Return type:bool
static is_night_time()

Determine if it is currently Night Time.

Returns:True, if it is night time. False, if not.
Return type:bool
static is_sun_out()

Determine if the Sun is currently out.

Returns:True, if the sun is out. False, if not.
Return type:bool
static pause_the_game()

Pause the game.

Returns:True, if successful. False, if not.
Return type:bool
static set_clock_speed(clock_speed)

Set the clock speed.

Parameters:clock_speed (ClockSpeedMode) – The speed to set the game clock to.
Returns:True, if successful. False, if not.
Return type:bool
static set_current_time(hours, minutes, seconds)

Set the current time.

Parameters:
  • hours (int) – The hour of the day to set the time to.
  • minutes (int) – The minute of the hour to set the time to.
  • seconds (int) – The second of the minute to set the time to.
static set_game_speed_normal()

Change the game time to Normal speed.

Returns:True, if successful. False, if not.
Return type:bool
static set_game_speed_to_interaction_startup_speed()

Change the game time to Interaction Startup Speed.

Returns:True, if successful. False, if not.
Return type:bool
static set_game_speed_to_speed_three()

Change the game time to Speed Three.

Returns:True, if successful. False, if not.
Return type:bool
static set_game_speed_to_speed_two()

Change the game time to Speed Two.

Returns:True, if successful. False, if not.
Return type:bool
static set_game_speed_to_super_speed_three()

Change the game time to Super Speed Three.

Returns:True, if successful. False, if not.
Return type:bool