Skip to content
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

[3.x] Backport the Time singleton from master #54056

Merged
merged 1 commit into from
Nov 29, 2021

Conversation

aaronfranke
Copy link
Member

@aaronfranke aaronfranke commented Oct 21, 2021

This PR backports the Time singleton from #49123. However, unlike that PR, this PR doesn't change the methods in the OS (_OS) singleton or use these methods internally, for the sake of preserving compatibility with 3.x projects.

This has the following use cases:

  • If someone needs time features not available in OS, they can use the Time singleton.
  • If someone is currently using the OS methods, they can switch to the Time singleton to future-proof their projects.

This was discussed with @ChronicallySerious on RocketChat, since he could make use of this class in the version control integration in Godot 3.5.

@twaritwaikar
Copy link
Contributor

Thanks for this! I was able to workaround the need for the Time class by just passing on the responsibility (of converting timestamps and the offsets to human readable strings) to the underlying VCS plugin.

But after this is merged, I can update the VCS interface to just require a timestamp and a timezone offset from the plugin and Godot handles the rest \o/

@qarmin
Copy link
Contributor

qarmin commented Oct 21, 2021

I will change test project around 17-19.
This change broke test project timer, so it can't close self after 30s
Nope, I didn't read this properly, leak is not caused by test project, but problem with code

@akien-mga
Copy link
Member

You could also include a cherry-pick of #54256 in this PR once the master one is merged.

@aaronfranke aaronfranke force-pushed the 3.x-time branch 2 times, most recently from 30c1afb to 967b8f7 Compare October 28, 2021 15:21
@aaronfranke aaronfranke force-pushed the 3.x-time branch 2 times, most recently from fa8e2d0 to a9fe18a Compare November 28, 2021 10:42
@akien-mga
Copy link
Member

Maybe add references to the Time singleton in the relevant OS methods which it's duplicating and deprecating?

doc/classes/OS.xml Outdated Show resolved Hide resolved
@akien-mga akien-mga merged commit 5120c67 into godotengine:3.x Nov 29, 2021
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants