-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Doc] Clarify description for get_unix_time_from_system
on UTC
#89454
Conversation
doc/classes/Time.xml
Outdated
@@ -180,7 +180,7 @@ | |||
<method name="get_unix_time_from_system" qualifiers="const"> | |||
<return type="float" /> | |||
<description> | |||
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. | |||
Returns the current Unix timestamp in seconds based on the system time. The Unix timestamp is the number of seconds passed since 00:00:00 UTC on 1 January 1970, the [url=https://en.wikipedia.org/wiki/Unix_time]Unix epoch[/url]. It is always in UTC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct. Timestamps do not need to be UTC (even though this method always is in UTC).
Most of the Time
class works with "the same timezone", so you can give it a timestamp in any time zone. Saying that it is always in UTC is not consistent with most of the Time class which allows non-UTC timestamps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant that the Unix epoch is based on UTC (00:00:00 UTC on 1 January 1970), and since this method returns seconds passed since that time, I thought it would mean it's in UTC as well.
Should I just remove the last phrase "It is always in UTC." ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can change it to this:
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 [url=https://en.wikipedia.org/wiki/Unix_time]Unix epoch[/url].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the quick reply. I'm slightly confused about keeping "always returns the time in UTC" because it feels like we wouldn't be addressing the problem raised in the original issue.
This method returns a time interval. It doesn't make sense to state "returns the time in UTC". A time interval is independent of any time zone.
Sorry for the confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR trying to solve this. There is some misunderstanding in the issue, I commented there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, thanks for the clarification there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left one comment, and the commits should be squashed, and then this is a good improvement.
fix url tag in doc/classes/Time.xml Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> fix url tag in doc/classes/Time.xml Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> update get_unix_time_from_system description Update doc/classes/Time.xml Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
b1ae779
to
8bfc257
Compare
get_unix_time_from_system
on UTC
Thanks! And congrats for your first merged Godot contribution 🎉 |
🎉🎉 Thank y'all for being so welcoming and helpful. |
Cherry-picked for 4.2.2. |
Cherry-picked for 4.1.4. |
Change description of get_unix_time_from_system to clarify what it does regarding UTC.
Fixes this issue from the godot-docs repository.