Table of Contents

Class TimeManager

Namespace
S1API.GameTime
Assembly
S1API.dll

Provides access to various time management functions in the game.

public static class TimeManager
Inheritance
TimeManager
Inherited Members

Fields

OnDayPass

Called when a new in-game day starts.

public static Action OnDayPass

Field Value

Action

OnHourPass

Called when a new in-game hour starts.

public static Action OnHourPass

Field Value

Action

OnSleepEnd

Called when the player finishes sleeping. Parameter: total minutes skipped during sleep.

public static Action<int> OnSleepEnd

Field Value

Action<int>

OnSleepStart

Called when the player starts sleeping.

public static Action OnSleepStart

Field Value

Action

OnTick

Called at every tick of gametime.

public static Action OnTick

Field Value

Action

OnWeekPass

Called when a new in-game week starts.

public static Action OnWeekPass

Field Value

Action

Properties

CurrentDay

The current in-game day (Monday, Tuesday, etc.).

public static Day CurrentDay { get; }

Property Value

Day

CurrentTime

The current 24-hour time (e.g., 1330 for 1:30 PM).

public static int CurrentTime { get; }

Property Value

int

ElapsedDays

The number of in-game days elapsed.

public static int ElapsedDays { get; }

Property Value

int

IsEndOfDay

Whether the game is currently at the end of the day (4:00 AM).

public static bool IsEndOfDay { get; }

Property Value

bool

IsNight

Whether it is currently nighttime in-game.

public static bool IsNight { get; }

Property Value

bool

NormalizedTime

The current normalized time of day (0.0 = start, 1.0 = end).

public static float NormalizedTime { get; }

Property Value

float

Playtime

Total playtime (in seconds).

public static float Playtime { get; }

Property Value

float

SleepInProgress

Whether the player is currently sleeping.

public static bool SleepInProgress { get; }

Property Value

bool

Methods

Get24HourTimeFromMinutes(int)

Converts total minutes into 24-hour time format.

public static int Get24HourTimeFromMinutes(int minutes)

Parameters

minutes int

Returns

int

GetFormatted12HourTime()

Gets the current time formatted in 12-hour AM/PM format.

public static string GetFormatted12HourTime()

Returns

string

GetMinutesFrom24HourTime(int)

Converts 24-hour time to total minutes.

public static int GetMinutesFrom24HourTime(int time24h)

Parameters

time24h int

Returns

int

IsCurrentTimeWithinRange(int, int)

Returns true if the current time is within the specified 24-hour range.

public static bool IsCurrentTimeWithinRange(int startTime24h, int endTime24h)

Parameters

startTime24h int
endTime24h int

Returns

bool

SetTime(int)

Sets the current time manually and synchronizes across the network. This can only be called by the host.

public static void SetTime(int time24h)

Parameters

time24h int