1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Time managing.
//!
//! This module exports several implementation of several _time generator_. A _time generator_ is
//! an object which type implements [`TimeGenerator`]. The idea is that _schedulers_ will need
//! several properties about time:
//!
//! - They obviously need to get access to _the current time_. That can represent anything, from
//! a simulation frame to a real-world clock.
//! - They need to _take into account_ the fact time passes. The speed at which it passes is
//! entirely up to the implementation of [`TimeGenerator`] for the type you choose. Time can
//! be ticked _forward_ but also _backwards_.
//! - Resetting the time generator resets its internals to its initial state.
//! - Time can be set explicitly, too.
//! - Finally, because time generators often _tick_ or _untick_ (ticking backards), it’s possible
//! to get a time difference between two ticks. That difference is called a _delta_ and it’s
//! also possible to change it.
//!
//! [`TimeGenerator`]: crate::time::TimeGenerator
/// Set of types that can handle time.
///
/// A time generator provides a way to:
///
/// - Get the current time.
/// - Tick forward time in order to get the “next time”.
/// - Tick backwards (a.k.a. unticking).
/// - Resetting to its initial or normal value.
/// - Change the internal delta time used to tick / untick.