class_time.rst 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Time.xml.
  6. .. _class_Time:
  7. Time
  8. ====
  9. **Inherits:** :ref:`Object<class_Object>`
  10. A singleton for working with time data.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. The Time singleton allows converting time between various formats and also getting time information from the system.
  15. 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.
  16. 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.
  17. 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>`__.
  18. \ **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).
  19. .. rst-class:: classref-reftable-group
  20. Methods
  21. -------
  22. .. table::
  23. :widths: auto
  24. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :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| |
  26. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :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| |
  28. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :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| |
  30. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :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| |
  32. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :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| |
  34. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :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| |
  36. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :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| |
  38. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :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| |
  40. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :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| |
  42. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :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| |
  44. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :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| |
  46. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`get_ticks_msec<class_Time_method_get_ticks_msec>`\ (\ ) |const| |
  48. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`get_ticks_usec<class_Time_method_get_ticks_usec>`\ (\ ) |const| |
  50. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :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| |
  52. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :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| |
  54. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :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| |
  56. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :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| |
  58. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_time_zone_from_system<class_Time_method_get_time_zone_from_system>`\ (\ ) |const| |
  60. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :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| |
  62. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :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| |
  64. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`float<class_float>` | :ref:`get_unix_time_from_system<class_Time_method_get_unix_time_from_system>`\ (\ ) |const| |
  66. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. .. rst-class:: classref-section-separator
  68. ----
  69. .. rst-class:: classref-descriptions-group
  70. Enumerations
  71. ------------
  72. .. _enum_Time_Month:
  73. .. rst-class:: classref-enumeration
  74. enum **Month**: :ref:`🔗<enum_Time_Month>`
  75. .. _class_Time_constant_MONTH_JANUARY:
  76. .. rst-class:: classref-enumeration-constant
  77. :ref:`Month<enum_Time_Month>` **MONTH_JANUARY** = ``1``
  78. The month of January, represented numerically as ``01``.
  79. .. _class_Time_constant_MONTH_FEBRUARY:
  80. .. rst-class:: classref-enumeration-constant
  81. :ref:`Month<enum_Time_Month>` **MONTH_FEBRUARY** = ``2``
  82. The month of February, represented numerically as ``02``.
  83. .. _class_Time_constant_MONTH_MARCH:
  84. .. rst-class:: classref-enumeration-constant
  85. :ref:`Month<enum_Time_Month>` **MONTH_MARCH** = ``3``
  86. The month of March, represented numerically as ``03``.
  87. .. _class_Time_constant_MONTH_APRIL:
  88. .. rst-class:: classref-enumeration-constant
  89. :ref:`Month<enum_Time_Month>` **MONTH_APRIL** = ``4``
  90. The month of April, represented numerically as ``04``.
  91. .. _class_Time_constant_MONTH_MAY:
  92. .. rst-class:: classref-enumeration-constant
  93. :ref:`Month<enum_Time_Month>` **MONTH_MAY** = ``5``
  94. The month of May, represented numerically as ``05``.
  95. .. _class_Time_constant_MONTH_JUNE:
  96. .. rst-class:: classref-enumeration-constant
  97. :ref:`Month<enum_Time_Month>` **MONTH_JUNE** = ``6``
  98. The month of June, represented numerically as ``06``.
  99. .. _class_Time_constant_MONTH_JULY:
  100. .. rst-class:: classref-enumeration-constant
  101. :ref:`Month<enum_Time_Month>` **MONTH_JULY** = ``7``
  102. The month of July, represented numerically as ``07``.
  103. .. _class_Time_constant_MONTH_AUGUST:
  104. .. rst-class:: classref-enumeration-constant
  105. :ref:`Month<enum_Time_Month>` **MONTH_AUGUST** = ``8``
  106. The month of August, represented numerically as ``08``.
  107. .. _class_Time_constant_MONTH_SEPTEMBER:
  108. .. rst-class:: classref-enumeration-constant
  109. :ref:`Month<enum_Time_Month>` **MONTH_SEPTEMBER** = ``9``
  110. The month of September, represented numerically as ``09``.
  111. .. _class_Time_constant_MONTH_OCTOBER:
  112. .. rst-class:: classref-enumeration-constant
  113. :ref:`Month<enum_Time_Month>` **MONTH_OCTOBER** = ``10``
  114. The month of October, represented numerically as ``10``.
  115. .. _class_Time_constant_MONTH_NOVEMBER:
  116. .. rst-class:: classref-enumeration-constant
  117. :ref:`Month<enum_Time_Month>` **MONTH_NOVEMBER** = ``11``
  118. The month of November, represented numerically as ``11``.
  119. .. _class_Time_constant_MONTH_DECEMBER:
  120. .. rst-class:: classref-enumeration-constant
  121. :ref:`Month<enum_Time_Month>` **MONTH_DECEMBER** = ``12``
  122. The month of December, represented numerically as ``12``.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _enum_Time_Weekday:
  126. .. rst-class:: classref-enumeration
  127. enum **Weekday**: :ref:`🔗<enum_Time_Weekday>`
  128. .. _class_Time_constant_WEEKDAY_SUNDAY:
  129. .. rst-class:: classref-enumeration-constant
  130. :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_SUNDAY** = ``0``
  131. The day of the week Sunday, represented numerically as ``0``.
  132. .. _class_Time_constant_WEEKDAY_MONDAY:
  133. .. rst-class:: classref-enumeration-constant
  134. :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_MONDAY** = ``1``
  135. The day of the week Monday, represented numerically as ``1``.
  136. .. _class_Time_constant_WEEKDAY_TUESDAY:
  137. .. rst-class:: classref-enumeration-constant
  138. :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_TUESDAY** = ``2``
  139. The day of the week Tuesday, represented numerically as ``2``.
  140. .. _class_Time_constant_WEEKDAY_WEDNESDAY:
  141. .. rst-class:: classref-enumeration-constant
  142. :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_WEDNESDAY** = ``3``
  143. The day of the week Wednesday, represented numerically as ``3``.
  144. .. _class_Time_constant_WEEKDAY_THURSDAY:
  145. .. rst-class:: classref-enumeration-constant
  146. :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_THURSDAY** = ``4``
  147. The day of the week Thursday, represented numerically as ``4``.
  148. .. _class_Time_constant_WEEKDAY_FRIDAY:
  149. .. rst-class:: classref-enumeration-constant
  150. :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_FRIDAY** = ``5``
  151. The day of the week Friday, represented numerically as ``5``.
  152. .. _class_Time_constant_WEEKDAY_SATURDAY:
  153. .. rst-class:: classref-enumeration-constant
  154. :ref:`Weekday<enum_Time_Weekday>` **WEEKDAY_SATURDAY** = ``6``
  155. The day of the week Saturday, represented numerically as ``6``.
  156. .. rst-class:: classref-section-separator
  157. ----
  158. .. rst-class:: classref-descriptions-group
  159. Method Descriptions
  160. -------------------
  161. .. _class_Time_method_get_date_dict_from_system:
  162. .. rst-class:: classref-method
  163. :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>`
  164. Returns the current date as a dictionary of keys: ``year``, ``month``, ``day``, and ``weekday``.
  165. The returned values are in the system's local time when ``utc`` is ``false``, otherwise they are in UTC.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_Time_method_get_date_dict_from_unix_time:
  169. .. rst-class:: classref-method
  170. :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>`
  171. Converts the given Unix timestamp to a dictionary of keys: ``year``, ``month``, ``day``, and ``weekday``.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_Time_method_get_date_string_from_system:
  175. .. rst-class:: classref-method
  176. :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>`
  177. Returns the current date as an ISO 8601 date string (YYYY-MM-DD).
  178. The returned values are in the system's local time when ``utc`` is ``false``, otherwise they are in UTC.
  179. .. rst-class:: classref-item-separator
  180. ----
  181. .. _class_Time_method_get_date_string_from_unix_time:
  182. .. rst-class:: classref-method
  183. :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>`
  184. Converts the given Unix timestamp to an ISO 8601 date string (YYYY-MM-DD).
  185. .. rst-class:: classref-item-separator
  186. ----
  187. .. _class_Time_method_get_datetime_dict_from_datetime_string:
  188. .. rst-class:: classref-method
  189. :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>`
  190. 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``.
  191. If ``weekday`` is ``false``, then the ``weekday`` entry is excluded (the calculation is relatively expensive).
  192. \ **Note:** Any decimal fraction in the time string will be ignored silently.
  193. .. rst-class:: classref-item-separator
  194. ----
  195. .. _class_Time_method_get_datetime_dict_from_system:
  196. .. rst-class:: classref-method
  197. :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>`
  198. Returns the current date as a dictionary of keys: ``year``, ``month``, ``day``, ``weekday``, ``hour``, ``minute``, ``second``, and ``dst`` (Daylight Savings Time).
  199. .. rst-class:: classref-item-separator
  200. ----
  201. .. _class_Time_method_get_datetime_dict_from_unix_time:
  202. .. rst-class:: classref-method
  203. :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>`
  204. Converts the given Unix timestamp to a dictionary of keys: ``year``, ``month``, ``day``, ``weekday``, ``hour``, ``minute``, and ``second``.
  205. 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.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_Time_method_get_datetime_string_from_datetime_dict:
  209. .. rst-class:: classref-method
  210. :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>`
  211. Converts the given dictionary of keys to an ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS).
  212. The given dictionary can be populated with the following keys: ``year``, ``month``, ``day``, ``hour``, ``minute``, and ``second``. Any other entries (including ``dst``) are ignored.
  213. 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).
  214. If ``use_space`` is ``true``, the date and time bits are separated by an empty space character instead of the letter T.
  215. .. rst-class:: classref-item-separator
  216. ----
  217. .. _class_Time_method_get_datetime_string_from_system:
  218. .. rst-class:: classref-method
  219. :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>`
  220. Returns the current date and time as an ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS).
  221. The returned values are in the system's local time when ``utc`` is ``false``, otherwise they are in UTC.
  222. If ``use_space`` is ``true``, the date and time bits are separated by an empty space character instead of the letter T.
  223. .. rst-class:: classref-item-separator
  224. ----
  225. .. _class_Time_method_get_datetime_string_from_unix_time:
  226. .. rst-class:: classref-method
  227. :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>`
  228. Converts the given Unix timestamp to an ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS).
  229. If ``use_space`` is ``true``, the date and time bits are separated by an empty space character instead of the letter T.
  230. .. rst-class:: classref-item-separator
  231. ----
  232. .. _class_Time_method_get_offset_string_from_offset_minutes:
  233. .. rst-class:: classref-method
  234. :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>`
  235. 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".
  236. .. rst-class:: classref-item-separator
  237. ----
  238. .. _class_Time_method_get_ticks_msec:
  239. .. rst-class:: classref-method
  240. :ref:`int<class_int>` **get_ticks_msec**\ (\ ) |const| :ref:`🔗<class_Time_method_get_ticks_msec>`
  241. Returns the amount of time passed in milliseconds since the engine started.
  242. Will always be positive or 0 and uses a 64-bit value (it will wrap after roughly 500 million years).
  243. .. rst-class:: classref-item-separator
  244. ----
  245. .. _class_Time_method_get_ticks_usec:
  246. .. rst-class:: classref-method
  247. :ref:`int<class_int>` **get_ticks_usec**\ (\ ) |const| :ref:`🔗<class_Time_method_get_ticks_usec>`
  248. Returns the amount of time passed in microseconds since the engine started.
  249. Will always be positive or 0 and uses a 64-bit value (it will wrap after roughly half a million years).
  250. .. rst-class:: classref-item-separator
  251. ----
  252. .. _class_Time_method_get_time_dict_from_system:
  253. .. rst-class:: classref-method
  254. :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>`
  255. Returns the current time as a dictionary of keys: ``hour``, ``minute``, and ``second``.
  256. The returned values are in the system's local time when ``utc`` is ``false``, otherwise they are in UTC.
  257. .. rst-class:: classref-item-separator
  258. ----
  259. .. _class_Time_method_get_time_dict_from_unix_time:
  260. .. rst-class:: classref-method
  261. :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>`
  262. Converts the given time to a dictionary of keys: ``hour``, ``minute``, and ``second``.
  263. .. rst-class:: classref-item-separator
  264. ----
  265. .. _class_Time_method_get_time_string_from_system:
  266. .. rst-class:: classref-method
  267. :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>`
  268. Returns the current time as an ISO 8601 time string (HH:MM:SS).
  269. The returned values are in the system's local time when ``utc`` is ``false``, otherwise they are in UTC.
  270. .. rst-class:: classref-item-separator
  271. ----
  272. .. _class_Time_method_get_time_string_from_unix_time:
  273. .. rst-class:: classref-method
  274. :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>`
  275. Converts the given Unix timestamp to an ISO 8601 time string (HH:MM:SS).
  276. .. rst-class:: classref-item-separator
  277. ----
  278. .. _class_Time_method_get_time_zone_from_system:
  279. .. rst-class:: classref-method
  280. :ref:`Dictionary<class_Dictionary>` **get_time_zone_from_system**\ (\ ) |const| :ref:`🔗<class_Time_method_get_time_zone_from_system>`
  281. Returns the current time zone as a dictionary of keys: ``bias`` and ``name``.
  282. - ``bias`` is the offset from UTC in minutes, since not all time zones are multiples of an hour from UTC.
  283. - ``name`` is the localized name of the time zone, according to the OS locale settings of the current user.
  284. .. rst-class:: classref-item-separator
  285. ----
  286. .. _class_Time_method_get_unix_time_from_datetime_dict:
  287. .. rst-class:: classref-method
  288. :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>`
  289. Converts a dictionary of time values to a Unix timestamp.
  290. The given dictionary can be populated with the following keys: ``year``, ``month``, ``day``, ``hour``, ``minute``, and ``second``. Any other entries (including ``dst``) are ignored.
  291. 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).
  292. 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.
  293. \ **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.
  294. .. rst-class:: classref-item-separator
  295. ----
  296. .. _class_Time_method_get_unix_time_from_datetime_string:
  297. .. rst-class:: classref-method
  298. :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>`
  299. 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.
  300. \ **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.
  301. \ **Note:** Any decimal fraction in the time string will be ignored silently.
  302. .. rst-class:: classref-item-separator
  303. ----
  304. .. _class_Time_method_get_unix_time_from_system:
  305. .. rst-class:: classref-method
  306. :ref:`float<class_float>` **get_unix_time_from_system**\ (\ ) |const| :ref:`🔗<class_Time_method_get_unix_time_from_system>`
  307. 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>`__.
  308. \ **Note:** Unlike other methods that use integer timestamps, this method returns the timestamp as a :ref:`float<class_float>` for sub-second precision.
  309. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  310. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  311. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  312. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  313. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  314. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  315. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  316. .. |void| replace:: :abbr:`void (No return value.)`