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

Make methods on Time, Timer, and Stopwatch more consistent #15834

Open
rparrett opened this issue Oct 10, 2024 · 1 comment
Open

Make methods on Time, Timer, and Stopwatch more consistent #15834

rparrett opened this issue Oct 10, 2024 · 1 comment
Labels
A-Time Involves time keeping and reporting C-Code-Quality A section of code that is hard to understand or change D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!

Comments

@rparrett
Copy link
Contributor

rparrett commented Oct 10, 2024

Bevy version

0.14 / main

What you did

Noticed some small inconsistencies between Time, Timer and Stopwatch while refactoring.

What went wrong

This may not be totally comprehensive.

Time Timer Stopwatch
elapsed_seconds elapsed_secs elapsed_secs
elapsed_seconds_f64 DNE elapsed_secs_f64
is_paused paused paused

At a glance, it seems like we should

  • Add _f64 stuff to Timer
  • Rename *_seconds to *_secs or vice versa
  • Rename paused to is_paused or vice versa

Additional information

When deciding on renames there may be other methods to look at (animation, audio, whatever) with similarly-named methods. e.g. AudioSink::is_paused, Duration::from_secs.

@rparrett rparrett added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Oct 10, 2024
@tim-blackbird
Copy link
Contributor

  • Rename *_seconds to *_secs or vice versa

I think we should follow the rust standard library and go with *_secs

  • Rename paused to is_paused or vice versa

The std shows a clear preference for is_*

@tim-blackbird tim-blackbird added C-Code-Quality A section of code that is hard to understand or change A-Time Involves time keeping and reporting and removed C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Oct 10, 2024
@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! labels Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Time Involves time keeping and reporting C-Code-Quality A section of code that is hard to understand or change D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!
Projects
None yet
Development

No branches or pull requests

3 participants