Skip to content

Remove everything except Instant from bevy_utils::time #17158

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

Merged

Conversation

bushrat011899
Copy link
Contributor

Objective

Solution

  • Removed everything except Instant from bevy_utils::time

Testing

  • CI

Migration Guide

If you relied on any of the following from bevy_utils::time:

  • Duration
  • TryFromFloatSecsError

Import these directly from core::time regardless of platform target (WASM, mobile, etc.)

If you relied on any of the following from bevy_utils::time:

  • SystemTime
  • SystemTimeError

Instead import these directly from either std::time or web_time as appropriate for your target platform.

Notes

Duration and TryFromFloatSecsError are both re-exports from core::time regardless of whether they are used from web_time or std::time, so there is no value gained from re-exporting them from bevy_utils::time as well. As for SystemTime and SystemTimeError, no Bevy internal crates or examples rely on these types. Since Bevy doesn't have a Time<Wall> resource for interacting with wall-time (and likely shouldn't need one), I think removing these from bevy_utils entirely and waiting for a use-case to justify inclusion is a reasonable path forward.

@bushrat011899 bushrat011899 added D-Trivial Nice and easy! A great choice to get started with Bevy C-Code-Quality A section of code that is hard to understand or change M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide A-Utils Utility functions and types X-Uncontroversial This work is generally agreed upon S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 5, 2025
@alice-i-cecile alice-i-cecile added X-Contentious There are nontrivial implications that should be thought through and removed X-Uncontroversial This work is generally agreed upon labels Jan 5, 2025
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this. I was skeptical at first, because the split web_time imports suck, but you're right about us not using them and not having an immediate use for it. As I'm sure you know, moving this into bevy_platform_compat is the next step here.

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 5, 2025
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 5, 2025
Merged via the queue into bevyengine:main with commit 3c829d7 Jan 5, 2025
30 checks passed
mrchantey pushed a commit to mrchantey/bevy that referenced this pull request Feb 4, 2025
…e#17158)

# Objective

- Contributes to bevyengine#11478
- Contributes to bevyengine#16877

## Solution

- Removed everything except `Instant` from `bevy_utils::time`

## Testing

- CI

---

## Migration Guide

If you relied on any of the following from `bevy_utils::time`:

- `Duration`
- `TryFromFloatSecsError`

Import these directly from `core::time` regardless of platform target
(WASM, mobile, etc.)

If you relied on any of the following from `bevy_utils::time`:

- `SystemTime`
- `SystemTimeError`

Instead import these directly from either `std::time` or `web_time` as
appropriate for your target platform.

## Notes

`Duration` and `TryFromFloatSecsError` are both re-exports from
`core::time` regardless of whether they are used from `web_time` or
`std::time`, so there is no value gained from re-exporting them from
`bevy_utils::time` as well. As for `SystemTime` and `SystemTimeError`,
no Bevy internal crates or examples rely on these types. Since Bevy
doesn't have a `Time<Wall>` resource for interacting with wall-time (and
likely shouldn't need one), I think removing these from `bevy_utils`
entirely and waiting for a use-case to justify inclusion is a reasonable
path forward.
rcorre added a commit to rcorre/matchbox that referenced this pull request Apr 27, 2025
Bevy 0.16 was released a few days ago, update `bevy_matchbox` to use that.
There weren't any major changes affecting matchbox that I could see.
The only things I had to adjust to were:

- `utils::Duration` was removed in favor of `core::Duration`: bevyengine/bevy#17158
- Logging now requires a feature
- `ecs::world::Command` moved to `prelude::Command`

See: https://bevyengine.org/news/bevy-0-16/.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Utils Utility functions and types 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 M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Contentious There are nontrivial implications that should be thought through
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants