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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// #![feature(test)]
//! # Time constraint reasoning
//!
//! This crate is dedicated to reasoning about time.
//! It deals with time constraints, propagate them and
//! maintain an agenda of all the possible dates consistent
//! with the user constraints.
//!
//! ## Time structures
//! Several time structures (interval, sets) are provided
//! to make easier time manipulation.
//!
//! This time data defines several operators for union, intersection,
//! translation in two ways:
//! * by using standard operators (`&` for intersection, `|` for unsion, `+/-` for translation)
//! * by using iterator traits (see module [`iter`]) which allows time manipulation with
//! saving memory allocation (no intermediate structures needed)
//!
//! ## Time constraint management
//! The module [`graph`] deals with time constraints graph and mainly provides two structures:
//! * [`graph::TimeGraph`]: the time constraints graph, a time constraint is defined as an interval
//! of duration between two instants, a graph could be considered as a collection of time constraints
//! * [`graph::TimeScheduler`]: the scheduler maintains a set of slots (one for each instant) according to
//! its time graph
//!
//! Any modification of constraints are automatically propagated (see [`graph::TimeGraph`] for more
//! informations about the propagation algorithm).
//!
pub use *;
pub use *;
use Debug;
use Neg;
// Inner value to represent infinite values (negative or positive)
const INFINITE_TIME_VALUE : i64 = i64MAX;
const SUBSEC_BITLEN: usize = 30; // more than nanosecond precision
// could be set to 20 for microseconds precision, to 10 for millisecond
// and set to 0 to get only second precision
// (but we kept nanos to be compliant with std::time precision)
// fractional part mask
const SUBSEC_BITMASK: i64 = !;
// max of seconds according to fract. part precision
const MAX_SEC: i64 = i64MAX >> SUBSEC_BITLEN;
/// # A unique point of a time window
///
/// Depending of the implementation, it could be relative to
/// a date (e.g. [`Timestamp`]) or a duration (e.g. [`TimeValue`]).
///
/// All the time data are internally represented by a number of *ticks*.
/// As a consequence, a tick is the most precision that you can get.
///
/// In this crate revision, the precision (i.e. the duration of one tick)
/// is fixed and equals a little bit less that a nanosecond.
/// It is exactly `1/2^30` seconde.