MCPcopy Create free account
hub / github.com/aws/clock-bound / get_time

Method get_time

clock-bound/src/daemon/time/clocks.rs:26–31  ·  view source on GitHub ↗

Get the current `Instant` by reading `ClockParameters`

(&self)

Source from the content-addressed store, hash-verified

24impl<T: ReadTsc> Clock<Utc> for ClockBound<T> {
25 /// Get the current `Instant` by reading `ClockParameters`
26 fn get_time(&self) -> Instant {
27 let current_tsc = TscCount::new(self.read_tsc.read_tsc().into());
28 // TODO: disregarding overflow of TSC, that will take a while, but worth thinking of
29 self.clock_parameters.time
30 + ((current_tsc - self.clock_parameters.tsc_count) * self.clock_parameters.period)
31 }
32}
33
34/// Wrapper around `CLOCK_REALTIME` reads, which provides a UTC timestamp.

Callers 10

nowMethod · 0.45
handle_tickMethod · 0.45
feedMethod · 0.45
feedMethod · 0.45
get_offset_and_rttMethod · 0.45
test_realtimeFunction · 0.45
test_monotonic_rawFunction · 0.45

Calls 2

newFunction · 0.50
read_tscMethod · 0.45

Tested by 2

test_realtimeFunction · 0.36
test_monotonic_rawFunction · 0.36