123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Time.xml.
- .. _class_Time:
- Time
- ====
- **Inherits:** :ref:`Object<class_Object>`
- A singleton for working with time data.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- The Time singleton allows converting time between various formats and also getting time information from the system.
- This class conforms with as many of the ISO 8601 standards as possible. All dates follow the Proleptic Gregorian calendar. As such, the day before ``1582-10-15`` is ``1582-10-14``, not ``1582-10-04``. The year before 1 AD (aka 1 BC) is number ``0``, with the year before that (2 BC) being ``-1``, etc.
- Conversion methods assume "the same timezone", and do not handle timezone conversions or DST automatically. Leap seconds are also not handled, they must be done manually if desired. Suffixes such as "Z" are not handled, you need to strip them away manually.
- When getting time information from the system, the time can either be in the local timezone or UTC depending on the ``utc`` parameter. However, the :ref:`get_unix_time_from_system<class_Time_method_get_unix_time_from_system>` method always uses UTC as it returns the seconds passed since the `Unix epoch <https://en.wikipedia.org/wiki/Unix_time>`__.
- \ **Important:** The ``_from_system`` methods use the system clock that the user can manually set. **Never use** this method for precise time calculation since its results are subject to automatic adjustments by the user or the operating system. **Always use** :ref:`get_ticks_usec<class_Time_method_get_ticks_usec>` or :ref:`get_ticks_msec<class_Time_method_get_ticks_msec>` for precise time calculation instead, since they are guaranteed to be monotonic (i.e. never decrease).
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`get_date_dict_from_system<class_Time_method_get_date_dict_from_system>`\ (\ utc\: :ref:`bool<class_bool>` = false\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`get_date_dict_from_unix_time<class_Time_method_get_date_dict_from_unix_time>`\ (\ unix_time_val\: :ref:`int<class_int>`\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_date_string_from_system<class_Time_method_get_date_string_from_system>`\ (\ utc\: :ref:`bool<class_bool>` = false\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_date_string_from_unix_time<class_Time_method_get_date_string_from_unix_time>`\ (\ unix_time_val\: :ref:`int<class_int>`\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`get_datetime_dict_from_datetime_string<class_Time_method_get_datetime_dict_from_datetime_string>`\ (\ datetime\: :ref:`String<class_String>`, weekday\: :ref:`bool<class_bool>`\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`get_datetime_dict_from_system<class_Time_method_get_datetime_dict_from_system>`\ (\ utc\: :ref:`bool<class_bool>` = false\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`get_datetime_dict_from_unix_time<class_Time_method_get_datetime_dict_from_unix_time>`\ (\ unix_time_val\: :ref:`int<class_int>`\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_datetime_string_from_datetime_dict<class_Time_method_get_datetime_string_from_datetime_dict>`\ (\ datetime\: :ref:`Dictionary<class_Dictionary>`, use_space\: :ref:`bool<class_bool>`\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_datetime_string_from_system<class_Time_method_get_datetime_string_from_system>`\ (\ utc\: :ref:`bool<class_bool>` = false, use_space\: :ref:`bool<class_bool>` = false\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_datetime_string_from_unix_time<class_Time_method_get_datetime_string_from_unix_time>`\ (\ unix_time_val\: :ref:`int<class_int>`, use_space\: :ref:`bool<class_bool>` = false\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_offset_string_from_offset_minutes<class_Time_method_get_offset_string_from_offset_minutes>`\ (\ offset_minutes\: :ref:`int<class_int>`\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_ticks_msec<class_Time_method_get_ticks_msec>`\ (\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_ticks_usec<class_Time_method_get_ticks_usec>`\ (\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`get_time_dict_from_system<class_Time_method_get_time_dict_from_system>`\ (\ utc\: :ref:`bool<class_bool>` = false\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`get_time_dict_from_unix_time<class_Time_method_get_time_dict_from_unix_time>`\ (\ unix_time_val\: :ref:`int<class_int>`\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_time_string_from_system<class_Time_method_get_time_string_from_system>`\ (\ utc\: :ref:`bool<class_bool>` = false\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_time_string_from_unix_time<class_Time_method_get_time_string_from_unix_time>`\ (\ unix_time_val\: :ref:`int<class_int>`\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`get_time_zone_from_system<class_Time_method_get_time_zone_from_system>`\ (\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_unix_time_from_datetime_dict<class_Time_method_get_unix_time_from_datetime_dict>`\ (\ datetime\: :ref:`Dictionary<class_Dictionary>`\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_unix_time_from_datetime_string<class_Time_method_get_unix_time_from_datetime_string>`\ (\ datetime\: :ref:`String<class_String>`\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_unix_time_from_system<class_Time_method_get_unix_time_from_system>`\ (\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Enumerations
- ------------
- .. _enum_Time_Month:
- .. rst-class:: classref-enumeration
- enum **Month**: :ref:`🔗<enum_Time_Month>`
- .. _class_Time_constant_MONTH_JANUARY:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_JANUARY** = ``1``
- The month of January, represented numerically as ``01``.
- .. _class_Time_constant_MONTH_FEBRUARY:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_FEBRUARY** = ``2``
- The month of February, represented numerically as ``02``.
- .. _class_Time_constant_MONTH_MARCH:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_MARCH** = ``3``
- The month of March, represented numerically as ``03``.
- .. _class_Time_constant_MONTH_APRIL:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_APRIL** = ``4``
- The month of April, represented numerically as ``04``.
- .. _class_Time_constant_MONTH_MAY:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_MAY** = ``5``
- The month of May, represented numerically as ``05``.
- .. _class_Time_constant_MONTH_JUNE:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_JUNE** = ``6``
- The month of June, represented numerically as ``06``.
- .. _class_Time_constant_MONTH_JULY:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_JULY** = ``7``
- The month of July, represented numerically as ``07``.
- .. _class_Time_constant_MONTH_AUGUST:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_AUGUST** = ``8``
- The month of August, represented numerically as ``08``.
- .. _class_Time_constant_MONTH_SEPTEMBER:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_SEPTEMBER** = ``9``
- The month of September, represented numerically as ``09``.
- .. _class_Time_constant_MONTH_OCTOBER:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_OCTOBER** = ``10``
- The month of October, represented numerically as ``10``.
- .. _class_Time_constant_MONTH_NOVEMBER:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_NOVEMBER** = ``11``
- The month of November, represented numerically as ``11``.
- .. _class_Time_constant_MONTH_DECEMBER:
- .. rst-class:: classref-enumeration-constant
- :ref:`Month<enum_Time_Month>` **MONTH_DECEMBER** = ``12``
- The month of December, represented numerically as ``12``.
- .. rst-class:: classref-item-separator
- ----
- .. _enum_Time_Weekday:
- .. rst-class:: classref-enumeration
- enum **Weekday**: :ref:`🔗<enum_Time_Weekday>`
- .. _class_Time_constant_WEEKDAY_SUNDAY:
- .. rst-class:: classref-enumeration-constant
- :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_SUNDAY** = ``0``
- The day of the week Sunday, represented numerically as ``0``.
- .. _class_Time_constant_WEEKDAY_MONDAY:
- .. rst-class:: classref-enumeration-constant
- :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_MONDAY** = ``1``
- The day of the week Monday, represented numerically as ``1``.
- .. _class_Time_constant_WEEKDAY_TUESDAY:
- .. rst-class:: classref-enumeration-constant
- :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_TUESDAY** = ``2``
- The day of the week Tuesday, represented numerically as ``2``.
- .. _class_Time_constant_WEEKDAY_WEDNESDAY:
- .. rst-class:: classref-enumeration-constant
- :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_WEDNESDAY** = ``3``
- The day of the week Wednesday, represented numerically as ``3``.
- .. _class_Time_constant_WEEKDAY_THURSDAY:
- .. rst-class:: classref-enumeration-constant
- :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_THURSDAY** = ``4``
- The day of the week Thursday, represented numerically as ``4``.
- .. _class_Time_constant_WEEKDAY_FRIDAY:
- .. rst-class:: classref-enumeration-constant
- :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_FRIDAY** = ``5``
- The day of the week Friday, represented numerically as ``5``.
- .. _class_Time_constant_WEEKDAY_SATURDAY:
- .. rst-class:: classref-enumeration-constant
- :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_SATURDAY** = ``6``
- The day of the week Saturday, represented numerically as ``6``.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_Time_method_get_date_dict_from_system:
- .. rst-class:: classref-method
- :ref:`Dictionary<class_Dictionary>` **get_date_dict_from_system**\ (\ utc\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Time_method_get_date_dict_from_system>`
- Returns the current date as a dictionary of keys: ``year``, ``month``, ``day``, and ``weekday``.
- The returned values are in the system's local time when ``utc`` is ``false``, otherwise they are in UTC.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_date_dict_from_unix_time:
- .. rst-class:: classref-method
- :ref:`Dictionary<class_Dictionary>` **get_date_dict_from_unix_time**\ (\ unix_time_val\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Time_method_get_date_dict_from_unix_time>`
- Converts the given Unix timestamp to a dictionary of keys: ``year``, ``month``, ``day``, and ``weekday``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_date_string_from_system:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_date_string_from_system**\ (\ utc\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Time_method_get_date_string_from_system>`
- Returns the current date as an ISO 8601 date string (YYYY-MM-DD).
- The returned values are in the system's local time when ``utc`` is ``false``, otherwise they are in UTC.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_date_string_from_unix_time:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_date_string_from_unix_time**\ (\ unix_time_val\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Time_method_get_date_string_from_unix_time>`
- Converts the given Unix timestamp to an ISO 8601 date string (YYYY-MM-DD).
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_datetime_dict_from_datetime_string:
- .. rst-class:: classref-method
- :ref:`Dictionary<class_Dictionary>` **get_datetime_dict_from_datetime_string**\ (\ datetime\: :ref:`String<class_String>`, weekday\: :ref:`bool<class_bool>`\ ) |const| :ref:`🔗<class_Time_method_get_datetime_dict_from_datetime_string>`
- Converts the given ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS) to a dictionary of keys: ``year``, ``month``, ``day``, ``weekday``, ``hour``, ``minute``, and ``second``.
- If ``weekday`` is ``false``, then the ``weekday`` entry is excluded (the calculation is relatively expensive).
- \ **Note:** Any decimal fraction in the time string will be ignored silently.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_datetime_dict_from_system:
- .. rst-class:: classref-method
- :ref:`Dictionary<class_Dictionary>` **get_datetime_dict_from_system**\ (\ utc\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Time_method_get_datetime_dict_from_system>`
- Returns the current date as a dictionary of keys: ``year``, ``month``, ``day``, ``weekday``, ``hour``, ``minute``, ``second``, and ``dst`` (Daylight Savings Time).
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_datetime_dict_from_unix_time:
- .. rst-class:: classref-method
- :ref:`Dictionary<class_Dictionary>` **get_datetime_dict_from_unix_time**\ (\ unix_time_val\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Time_method_get_datetime_dict_from_unix_time>`
- Converts the given Unix timestamp to a dictionary of keys: ``year``, ``month``, ``day``, ``weekday``, ``hour``, ``minute``, and ``second``.
- The returned Dictionary's values will be the same as the :ref:`get_datetime_dict_from_system<class_Time_method_get_datetime_dict_from_system>` if the Unix timestamp is the current time, with the exception of Daylight Savings Time as it cannot be determined from the epoch.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_datetime_string_from_datetime_dict:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_datetime_string_from_datetime_dict**\ (\ datetime\: :ref:`Dictionary<class_Dictionary>`, use_space\: :ref:`bool<class_bool>`\ ) |const| :ref:`🔗<class_Time_method_get_datetime_string_from_datetime_dict>`
- Converts the given dictionary of keys to an ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS).
- The given dictionary can be populated with the following keys: ``year``, ``month``, ``day``, ``hour``, ``minute``, and ``second``. Any other entries (including ``dst``) are ignored.
- If the dictionary is empty, ``0`` is returned. If some keys are omitted, they default to the equivalent values for the Unix epoch timestamp 0 (1970-01-01 at 00:00:00).
- If ``use_space`` is ``true``, the date and time bits are separated by an empty space character instead of the letter T.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_datetime_string_from_system:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_datetime_string_from_system**\ (\ utc\: :ref:`bool<class_bool>` = false, use_space\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Time_method_get_datetime_string_from_system>`
- Returns the current date and time as an ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS).
- The returned values are in the system's local time when ``utc`` is ``false``, otherwise they are in UTC.
- If ``use_space`` is ``true``, the date and time bits are separated by an empty space character instead of the letter T.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_datetime_string_from_unix_time:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_datetime_string_from_unix_time**\ (\ unix_time_val\: :ref:`int<class_int>`, use_space\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Time_method_get_datetime_string_from_unix_time>`
- Converts the given Unix timestamp to an ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS).
- If ``use_space`` is ``true``, the date and time bits are separated by an empty space character instead of the letter T.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_offset_string_from_offset_minutes:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_offset_string_from_offset_minutes**\ (\ offset_minutes\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Time_method_get_offset_string_from_offset_minutes>`
- Converts the given timezone offset in minutes to a timezone offset string. For example, -480 returns "-08:00", 345 returns "+05:45", and 0 returns "+00:00".
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_ticks_msec:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_ticks_msec**\ (\ ) |const| :ref:`🔗<class_Time_method_get_ticks_msec>`
- Returns the amount of time passed in milliseconds since the engine started.
- Will always be positive or 0 and uses a 64-bit value (it will wrap after roughly 500 million years).
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_ticks_usec:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_ticks_usec**\ (\ ) |const| :ref:`🔗<class_Time_method_get_ticks_usec>`
- Returns the amount of time passed in microseconds since the engine started.
- Will always be positive or 0 and uses a 64-bit value (it will wrap after roughly half a million years).
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_time_dict_from_system:
- .. rst-class:: classref-method
- :ref:`Dictionary<class_Dictionary>` **get_time_dict_from_system**\ (\ utc\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Time_method_get_time_dict_from_system>`
- Returns the current time as a dictionary of keys: ``hour``, ``minute``, and ``second``.
- The returned values are in the system's local time when ``utc`` is ``false``, otherwise they are in UTC.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_time_dict_from_unix_time:
- .. rst-class:: classref-method
- :ref:`Dictionary<class_Dictionary>` **get_time_dict_from_unix_time**\ (\ unix_time_val\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Time_method_get_time_dict_from_unix_time>`
- Converts the given time to a dictionary of keys: ``hour``, ``minute``, and ``second``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_time_string_from_system:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_time_string_from_system**\ (\ utc\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Time_method_get_time_string_from_system>`
- Returns the current time as an ISO 8601 time string (HH:MM:SS).
- The returned values are in the system's local time when ``utc`` is ``false``, otherwise they are in UTC.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_time_string_from_unix_time:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_time_string_from_unix_time**\ (\ unix_time_val\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Time_method_get_time_string_from_unix_time>`
- Converts the given Unix timestamp to an ISO 8601 time string (HH:MM:SS).
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_time_zone_from_system:
- .. rst-class:: classref-method
- :ref:`Dictionary<class_Dictionary>` **get_time_zone_from_system**\ (\ ) |const| :ref:`🔗<class_Time_method_get_time_zone_from_system>`
- Returns the current time zone as a dictionary of keys: ``bias`` and ``name``.
- - ``bias`` is the offset from UTC in minutes, since not all time zones are multiples of an hour from UTC.
- - ``name`` is the localized name of the time zone, according to the OS locale settings of the current user.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_unix_time_from_datetime_dict:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_unix_time_from_datetime_dict**\ (\ datetime\: :ref:`Dictionary<class_Dictionary>`\ ) |const| :ref:`🔗<class_Time_method_get_unix_time_from_datetime_dict>`
- Converts a dictionary of time values to a Unix timestamp.
- The given dictionary can be populated with the following keys: ``year``, ``month``, ``day``, ``hour``, ``minute``, and ``second``. Any other entries (including ``dst``) are ignored.
- If the dictionary is empty, ``0`` is returned. If some keys are omitted, they default to the equivalent values for the Unix epoch timestamp 0 (1970-01-01 at 00:00:00).
- You can pass the output from :ref:`get_datetime_dict_from_unix_time<class_Time_method_get_datetime_dict_from_unix_time>` directly into this function and get the same as what was put in.
- \ **Note:** Unix timestamps are often in UTC. This method does not do any timezone conversion, so the timestamp will be in the same timezone as the given datetime dictionary.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_unix_time_from_datetime_string:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_unix_time_from_datetime_string**\ (\ datetime\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Time_method_get_unix_time_from_datetime_string>`
- Converts the given ISO 8601 date and/or time string to a Unix timestamp. The string can contain a date only, a time only, or both.
- \ **Note:** Unix timestamps are often in UTC. This method does not do any timezone conversion, so the timestamp will be in the same timezone as the given datetime string.
- \ **Note:** Any decimal fraction in the time string will be ignored silently.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Time_method_get_unix_time_from_system:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_unix_time_from_system**\ (\ ) |const| :ref:`🔗<class_Time_method_get_unix_time_from_system>`
- Returns the current Unix timestamp in seconds based on the system time in UTC. This method is implemented by the operating system and always returns the time in UTC. The Unix timestamp is the number of seconds passed since 1970-01-01 at 00:00:00, the `Unix epoch <https://en.wikipedia.org/wiki/Unix_time>`__.
- \ **Note:** Unlike other methods that use integer timestamps, this method returns the timestamp as a :ref:`float<class_float>` for sub-second precision.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|