Skip to content

Class

TimeSnapshot

Generated GDScript class reference for CalendarTime.TimeSnapshot.

Status
Current
Version
v2.1.1
Source updated
2026-08-09
Generated on
2026-09-26

In-memory save DTO for a GameClock: an identifier, the canonical integer microsecond count, and the derived DateTime. The serializer fills it from the clock's current_microseconds, stores via to_dict(), and restores via from_dict().

Source: addons/calendar_time/game_time/state/time_snapshot.gd

Syntax

class TimeSnapshot extends RefCounted

Members

NameKindSummary
serialization_idPropertyIdentifier in serialized saves (`Keys.SERIALIZATION_ID`); the literal `"time_state"` is the preserved legacy 1.x dict-key (MIGRATION.md §5).
calendarPropertyUsed only by from_dict() to recompute date_time for legacy game_seconds saves; v3+ saves the DateTime directly.
date_timePropertyDateTime captured in the save (v3+ serializes it; legacy saves recompute it).
epochPropertyOptional save-time epoch. Persisted with the canonical µs so `date_time()` reconstructs the same date; without it a custom epoch reverts on load.
game_microsecondsPropertyCanonical elapsed game time as exact integer microseconds: the persisted source of truth; game_seconds and dates derive from it.
game_secondsPropertyFloat view of `game_microseconds`; writes round to whole microseconds.
validateMethod
from_dictMethod
to_dictMethod
SCHEMA_VERSIONFieldOn-disk key schema version. v2 used "id"; v3 "serialization_id"; v4 adds schema_version and calendar_identity.
SCHEMA_VERSION_KEYFieldSchema v4 key for the version number itself.
SERIALIZATION_IDFieldSchema v3 key. Written by to_dict().
DATE_TIMEFieldDate-time value is serialized under this key.
GAME_MICROSECONDSFieldSchema v3 canonical clock: exact integer game-microseconds.
CALENDAR_IDENTITYFieldCalendar fingerprint used to interpret elapsed microseconds; mismatch on load warns but does not block loading.
GAME_TICKSFieldLegacy key, auto-migrated to GAME_MICROSECONDS (MIGRATION.md §5).
GAME_SECONDSFieldGame-seconds value is serialized under this key.
EPOCHFieldEpoch key (v3+), written only for non-default epochs.
LEGACY_IDFieldLegacy v1/v2 key, auto-migrated to SERIALIZATION_ID (MIGRATION.md §5).
get_keysMethod