#![doc = include_str!("../README.md")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![forbid(unsafe_code)] #![doc( html_logo_url = "https://bevyengine.org/assets/icon.png", html_favicon_url = "https://bevyengine.org/assets/icon.png" )] #![no_std] #[cfg(feature = "std")] extern crate std; extern crate alloc; /// Common run conditions pub mod common_conditions; mod fixed; mod real; mod stopwatch; mod time; mod timer; mod virt; pub use fixed::*; pub use real::*; pub use stopwatch::*; pub use time::*; pub use timer::*; pub use virt::*; /// The time prelude. /// /// This includes the most common types in this crate, re-exported for your convenience. pub mod prelude { #[doc(hidden)] pub use crate::{Fixed, Real, Time, Timer, TimerMode, Virtual}; } use bevy_app::{prelude::*, RunFixedMainLoop}; use bevy_ecs::{ event::{event_update_system, signal_event_update_system, EventRegistry, ShouldUpdateEvents}, prelude::*, }; use bevy_platform_support::time::Instant; use core::time::Duration; #[cfg(feature = "std")] pub use crossbeam_channel::TrySendError; #[cfg(feature = "std")] use crossbeam_channel::{Receiver, Sender}; /// Adds time functionality to Apps. #[derive(Default)] pub struct TimePlugin; /// Updates the elapsed time. Any system that interacts with [`Time`] component should run after /// this. #[derive(Debug, PartialEq, Eq, Clone, Hash, SystemSet)] pub struct TimeSystem; impl Plugin for TimePlugin { fn build(&self, app: &mut App) { app.init_resource::