Skip to content

Commit

Permalink
Merge #83: Clock: Time Extent, Maker, and Associated Traits
Browse files Browse the repository at this point in the history
e785a7f time extent: overhaul tests naming scheme (Cameron Garnham)
3d743ed time extent: use snake_case for module name (Cameron Garnham)
8653f9a time extent: rename `TimeExtentMaker` for clarity (Cameron Garnham)
0cab30c time extent: add tests and some corrections (Cameron Garnham)
028644d clock: time extent, maker, and associated traits (Cameron Garnham)

Pull request description:

  `TimeExtent` is a simple structure that contains base increment (duration), and amount (a multiplier for the base the base increment). The resulting product of the base and the multiplier is the total duration of the time extent.

  `TimeExtentClock` is a helper that generates time extents based upon the increment length and the time of the clock, this clock is specialised according to the `test` predicate with the `DefaultClockExtentMaker` type.

  These modules will be used by the later connection cookie implementation.

ACKs for top commit:
  da2ce7:
    ACK e785a7f

Tree-SHA512: ba667cb47f9c5116355cbf34ea275d46404b09c5c1ff4aa825db2da49884a430174849b22c22a1b32b206bf06d7c34a054dc76b94a24e267205df909d0b3045d
  • Loading branch information
da2ce7 committed Sep 22, 2022
2 parents 8da9963 + e785a7f commit a049e29
Show file tree
Hide file tree
Showing 2 changed files with 558 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/protocol/clock.rs → src/protocol/clock/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::num::IntErrorKind;
pub use std::time::Duration;
use std::time::Duration;

pub type DurationSinceUnixEpoch = Duration;

Expand Down Expand Up @@ -240,9 +240,11 @@ mod stopped_clock {

#[test]
fn it_should_get_app_start_time() {
const TIME_AT_WRITING_THIS_TEST: Duration = Duration::new(1662983731, 000022312);
const TIME_AT_WRITING_THIS_TEST: Duration = Duration::new(1662983731, 22312);
assert!(get_app_start_time() > TIME_AT_WRITING_THIS_TEST);
}
}
}
}

pub mod time_extent;
Loading

0 comments on commit a049e29

Please sign in to comment.