diff options
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/@GlobalScope.xml | 3 | ||||
-rw-r--r-- | doc/classes/File.xml | 2 | ||||
-rw-r--r-- | doc/classes/OS.xml | 78 | ||||
-rw-r--r-- | doc/classes/Time.xml | 270 | ||||
-rw-r--r-- | doc/classes/XRServer.xml | 4 |
5 files changed, 276 insertions, 81 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index ed0cf5bd5d..552fc41318 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1261,6 +1261,9 @@ <member name="TextServerManager" type="TextServerManager" setter="" getter=""> The [TextServerManager] singleton. </member> + <member name="Time" type="Time" setter="" getter=""> + The [Time] singleton. + </member> <member name="TranslationServer" type="TranslationServer" setter="" getter=""> The [TranslationServer] singleton. </member> diff --git a/doc/classes/File.xml b/doc/classes/File.xml index ea3b82dc54..efaed8ddb4 100644 --- a/doc/classes/File.xml +++ b/doc/classes/File.xml @@ -188,7 +188,7 @@ <argument index="0" name="file" type="String"> </argument> <description> - Returns the last time the [code]file[/code] was modified in unix timestamp format or returns a [String] "ERROR IN [code]file[/code]". This unix timestamp can be converted to datetime by using [method OS.get_datetime_from_unix_time]. + Returns the last time the [code]file[/code] was modified in Unix timestamp format or returns a [String] "ERROR IN [code]file[/code]". This Unix timestamp can be converted to another format using the [Time] singleton. </description> </method> <method name="get_pascal_string"> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index c755c73465..bfcd5b1beb 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -176,34 +176,6 @@ [b]Note:[/b] This method is implemented on Linux, macOS and Windows. </description> </method> - <method name="get_date" qualifiers="const"> - <return type="Dictionary"> - </return> - <argument index="0" name="utc" type="bool" default="false"> - </argument> - <description> - Returns current date as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]dst[/code] (Daylight Savings Time). - </description> - </method> - <method name="get_datetime" qualifiers="const"> - <return type="Dictionary"> - </return> - <argument index="0" name="utc" type="bool" default="false"> - </argument> - <description> - Returns current datetime as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]dst[/code] (Daylight Savings Time), [code]hour[/code], [code]minute[/code], [code]second[/code]. - </description> - </method> - <method name="get_datetime_from_unix_time" qualifiers="const"> - <return type="Dictionary"> - </return> - <argument index="0" name="unix_time_val" type="int"> - </argument> - <description> - Gets a dictionary of time values corresponding to the given UNIX epoch time (in seconds). - The returned Dictionary's values will be the same as [method get_datetime], with the exception of Daylight Savings Time as it cannot be determined from the epoch. - </description> - </method> <method name="get_environment" qualifiers="const"> <return type="String"> </return> @@ -320,36 +292,6 @@ [b]Note:[/b] Thread IDs are not deterministic and may be reused across application restarts. </description> </method> - <method name="get_ticks_msec" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the amount of time passed in milliseconds since the engine started. - </description> - </method> - <method name="get_ticks_usec" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the amount of time passed in microseconds since the engine started. - </description> - </method> - <method name="get_time" qualifiers="const"> - <return type="Dictionary"> - </return> - <argument index="0" name="utc" type="bool" default="false"> - </argument> - <description> - Returns current time as a dictionary of keys: hour, minute, second. - </description> - </method> - <method name="get_time_zone_info" qualifiers="const"> - <return type="Dictionary"> - </return> - <description> - Returns the current time zone as a dictionary with the keys: bias and name. - </description> - </method> <method name="get_unique_id" qualifiers="const"> <return type="String"> </return> @@ -359,26 +301,6 @@ [b]Note:[/b] Returns an empty string on HTML5 and UWP, as this method isn't implemented on those platforms yet. </description> </method> - <method name="get_unix_time" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the current UNIX epoch timestamp in seconds. - [b]Important:[/b] This is the system clock that the user can manually set. [b]Never use[/b] this method for precise time calculation since its results are also subject to automatic adjustments by the operating system. [b]Always use[/b] [method get_ticks_usec] or [method get_ticks_msec] for precise time calculation instead, since they are guaranteed to be monotonic (i.e. never decrease). - </description> - </method> - <method name="get_unix_time_from_datetime" qualifiers="const"> - <return type="int"> - </return> - <argument index="0" name="datetime" type="Dictionary"> - </argument> - <description> - Gets an epoch time value from a dictionary of time values. - [code]datetime[/code] must be populated with the following keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]hour[/code], [code]minute[/code], [code]second[/code]. - If the dictionary is empty [code]0[/code] 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 UTC). - You can pass the output from [method get_datetime_from_unix_time] directly into this function. Daylight Savings Time ([code]dst[/code]), if present, is ignored. - </description> - </method> <method name="get_user_data_dir" qualifiers="const"> <return type="String"> </return> diff --git a/doc/classes/Time.xml b/doc/classes/Time.xml new file mode 100644 index 0000000000..0c7c090e97 --- /dev/null +++ b/doc/classes/Time.xml @@ -0,0 +1,270 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="Time" inherits="Object" version="4.0"> + <brief_description> + Time singleton for working with time. + </brief_description> + <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 [code]1582-10-15[/code] is [code]1582-10-14[/code], not [code]1582-10-04[/code]. The year before 1 AD (aka 1 BC) is number [code]0[/code], with the year before that (2 BC) being [code]-1[/code], 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. + [b]Important:[/b] The [code]_from_system[/code] methods use the system clock that the user can manually set. [b]Never use[/b] this method for precise time calculation since its results are subject to automatic adjustments by the user or the operating system. [b]Always use[/b] [method get_ticks_usec] or [method get_ticks_msec] for precise time calculation instead, since they are guaranteed to be monotonic (i.e. never decrease). + </description> + <tutorials> + </tutorials> + <methods> + <method name="get_date_dict_from_system" qualifiers="const"> + <return type="Dictionary"> + </return> + <argument index="0" name="utc" type="bool" default="false"> + </argument> + <description> + Returns the current date as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], and [code]dst[/code] (Daylight Savings Time). + The returned values are in the system's local time when [code]utc[/code] is false, otherwise they are in UTC. + </description> + </method> + <method name="get_date_dict_from_unix_time" qualifiers="const"> + <return type="Dictionary"> + </return> + <argument index="0" name="unix_time_val" type="int"> + </argument> + <description> + Converts the given Unix timestamp to a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], and [code]weekday[/code]. + </description> + </method> + <method name="get_date_string_from_system" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="utc" type="bool" default="false"> + </argument> + <description> + Returns the current date as an ISO 8601 date string (YYYY-MM-DD). + The returned values are in the system's local time when [code]utc[/code] is false, otherwise they are in UTC. + </description> + </method> + <method name="get_date_string_from_unix_time" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="unix_time_val" type="int"> + </argument> + <description> + Converts the given Unix timestamp to an ISO 8601 date string (YYYY-MM-DD). + </description> + </method> + <method name="get_datetime_dict_from_string" qualifiers="const"> + <return type="Dictionary"> + </return> + <argument index="0" name="datetime" type="String"> + </argument> + <argument index="1" name="weekday" type="bool"> + </argument> + <description> + Converts the given ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS) to a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]hour[/code], [code]minute[/code], and [code]second[/code]. + If [code]weekday[/code] is false, then the [code]weekday[/code] entry is excluded (the calculation is relatively expensive). + </description> + </method> + <method name="get_datetime_dict_from_system" qualifiers="const"> + <return type="Dictionary"> + </return> + <argument index="0" name="utc" type="bool" default="false"> + </argument> + <description> + Returns the current date as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]hour[/code], [code]minute[/code], and [code]second[/code]. + </description> + </method> + <method name="get_datetime_dict_from_unix_time" qualifiers="const"> + <return type="Dictionary"> + </return> + <argument index="0" name="unix_time_val" type="int"> + </argument> + <description> + Converts the given Unix timestamp to a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], and [code]weekday[/code]. + The returned Dictionary's values will be the same as the [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. + </description> + </method> + <method name="get_datetime_string_from_dict" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="datetime" type="Dictionary"> + </argument> + <argument index="1" name="use_space" type="bool"> + </argument> + <description> + 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: [code]year[/code], [code]month[/code], [code]day[/code], [code]hour[/code], [code]minute[/code], and [code]second[/code]. Any other entries (including [code]dst[/code]) are ignored. + If the dictionary is empty, [code]0[/code] 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 [code]use_space[/code] is true, use a space instead of the letter T in the middle. + </description> + </method> + <method name="get_datetime_string_from_system" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="utc" type="bool" default="false"> + </argument> + <argument index="1" name="use_space" type="bool" default="false"> + </argument> + <description> + Returns the current date and time as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]dst[/code] (Daylight Savings Time), [code]hour[/code], [code]minute[/code], and [code]second[/code]. + The returned values are in the system's local time when [code]utc[/code] is false, otherwise they are in UTC. + If [code]use_space[/code] is true, use a space instead of the letter T in the middle. + </description> + </method> + <method name="get_datetime_string_from_unix_time" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="unix_time_val" type="int"> + </argument> + <argument index="1" name="use_space" type="bool" default="false"> + </argument> + <description> + Converts the given Unix timestamp to an ISO 8601 date and time string (YYYY-MM-DDTHH:MM:SS). + If [code]use_space[/code] is true, use a space instead of the letter T in the middle. + </description> + </method> + <method name="get_ticks_msec" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns the amount of time passed in milliseconds since the engine started. + </description> + </method> + <method name="get_ticks_usec" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns the amount of time passed in microseconds since the engine started. + </description> + </method> + <method name="get_time_dict_from_system" qualifiers="const"> + <return type="Dictionary"> + </return> + <argument index="0" name="utc" type="bool" default="false"> + </argument> + <description> + Returns the current time as a dictionary of keys: [code]hour[/code], [code]minute[/code], and [code]second[/code]. + The returned values are in the system's local time when [code]utc[/code] is false, otherwise they are in UTC. + </description> + </method> + <method name="get_time_dict_from_unix_time" qualifiers="const"> + <return type="Dictionary"> + </return> + <argument index="0" name="unix_time_val" type="int"> + </argument> + <description> + Converts the given time to a dictionary of keys: [code]hour[/code], [code]minute[/code], and [code]second[/code]. + </description> + </method> + <method name="get_time_string_from_system" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="utc" type="bool" default="false"> + </argument> + <description> + Returns the current time as an ISO 8601 time string (HH:MM:SS). + The returned values are in the system's local time when [code]utc[/code] is false, otherwise they are in UTC. + </description> + </method> + <method name="get_time_string_from_unix_time" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="unix_time_val" type="int"> + </argument> + <description> + Converts the given Unix timestamp to an ISO 8601 time string (HH:MM:SS). + </description> + </method> + <method name="get_time_zone_from_system" qualifiers="const"> + <return type="Dictionary"> + </return> + <description> + Returns the current time zone as a dictionary of keys: [code]bias[/code] and [code]name[/code]. The [code]bias[/code] value is the offset from UTC in minutes, since not all time zones are multiples of an hour from UTC. + </description> + </method> + <method name="get_unix_time_from_datetime_dict" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="datetime" type="Dictionary"> + </argument> + <description> + Converts a dictionary of time values to a Unix timestamp. + The given dictionary can be populated with the following keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]hour[/code], [code]minute[/code], and [code]second[/code]. Any other entries (including [code]dst[/code]) are ignored. + If the dictionary is empty, [code]0[/code] 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 [method get_datetime_dict_from_unix_time] directly into this function and get the same as what was put in. + </description> + </method> + <method name="get_unix_time_from_datetime_string" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="datetime" type="String"> + </argument> + <description> + 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. + </description> + </method> + <method name="get_unix_time_from_system" qualifiers="const"> + <return type="float"> + </return> + <description> + Returns the current Unix timestamp in seconds based on the system time. + </description> + </method> + </methods> + <constants> + <constant name="MONTH_JANUARY" value="1" enum="Month"> + The month of January, represented numerically as [code]01[/code]. + </constant> + <constant name="MONTH_FEBRUARY" value="2" enum="Month"> + The month of February, represented numerically as [code]02[/code]. + </constant> + <constant name="MONTH_MARCH" value="3" enum="Month"> + The month of March, represented numerically as [code]03[/code]. + </constant> + <constant name="MONTH_APRIL" value="4" enum="Month"> + The month of April, represented numerically as [code]04[/code]. + </constant> + <constant name="MONTH_MAY" value="5" enum="Month"> + The month of May, represented numerically as [code]05[/code]. + </constant> + <constant name="MONTH_JUNE" value="6" enum="Month"> + The month of June, represented numerically as [code]06[/code]. + </constant> + <constant name="MONTH_JULY" value="7" enum="Month"> + The month of July, represented numerically as [code]07[/code]. + </constant> + <constant name="MONTH_AUGUST" value="8" enum="Month"> + The month of August, represented numerically as [code]08[/code]. + </constant> + <constant name="MONTH_SEPTEMBER" value="9" enum="Month"> + The month of September, represented numerically as [code]09[/code]. + </constant> + <constant name="MONTH_OCTOBER" value="10" enum="Month"> + The month of October, represented numerically as [code]10[/code]. + </constant> + <constant name="MONTH_NOVEMBER" value="11" enum="Month"> + The month of November, represented numerically as [code]11[/code]. + </constant> + <constant name="MONTH_DECEMBER" value="12" enum="Month"> + The month of December, represented numerically as [code]12[/code]. + </constant> + <constant name="WEEKDAY_SUNDAY" value="0" enum="Weekday"> + The day of the week Sunday, represented numerically as [code]0[/code]. + </constant> + <constant name="WEEKDAY_MONDAY" value="1" enum="Weekday"> + The day of the week Monday, represented numerically as [code]1[/code]. + </constant> + <constant name="WEEKDAY_TUESDAY" value="2" enum="Weekday"> + The day of the week Tuesday, represented numerically as [code]2[/code]. + </constant> + <constant name="WEEKDAY_WEDNESDAY" value="3" enum="Weekday"> + The day of the week Wednesday, represented numerically as [code]3[/code]. + </constant> + <constant name="WEEKDAY_THURSDAY" value="4" enum="Weekday"> + The day of the week Thursday, represented numerically as [code]4[/code]. + </constant> + <constant name="WEEKDAY_FRIDAY" value="5" enum="Weekday"> + The day of the week Friday, represented numerically as [code]5[/code]. + </constant> + <constant name="WEEKDAY_SATURDAY" value="6" enum="Weekday"> + The day of the week Saturday, represented numerically as [code]6[/code]. + </constant> + </constants> +</class> diff --git a/doc/classes/XRServer.xml b/doc/classes/XRServer.xml index 8284fa4a89..149e177700 100644 --- a/doc/classes/XRServer.xml +++ b/doc/classes/XRServer.xml @@ -96,7 +96,7 @@ <return type="int"> </return> <description> - Returns the absolute timestamp (in μs) of the last [XRServer] commit of the AR/VR eyes to [RenderingServer]. The value comes from an internal call to [method OS.get_ticks_usec]. + Returns the absolute timestamp (in μs) of the last [XRServer] commit of the AR/VR eyes to [RenderingServer]. The value comes from an internal call to [method Time.get_ticks_usec]. </description> </method> <method name="get_last_frame_usec"> @@ -110,7 +110,7 @@ <return type="int"> </return> <description> - Returns the absolute timestamp (in μs) of the last [XRServer] process callback. The value comes from an internal call to [method OS.get_ticks_usec]. + Returns the absolute timestamp (in μs) of the last [XRServer] process callback. The value comes from an internal call to [method Time.get_ticks_usec]. </description> </method> <method name="get_reference_frame" qualifiers="const"> |