A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
Loading...
Searching...
No Matches
time.h File Reference

A11's time primitives: nanosecond-aware durations and instants. More...

#include <cstdint>
#include <absl/status/statusor.h>
#include <absl/time/time.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  a11
 

Typedefs

using a11::Duration = absl::Duration
 A11 duration; an alias of absl::Duration (nanosecond-aware).
 
using a11::Time = absl::Time
 A11 instant; an alias of absl::Time (nanosecond-aware).
 

Functions

Duration a11::ZeroDuration ()
 Returns the zero duration.
 
Duration a11::InfiniteDuration ()
 Returns the duration greater than every finite duration.
 
Time a11::Now ()
 Returns the current wall-clock time from Abseil's clock.
 
Time a11::InfiniteFuture ()
 Returns the instant later than every finite time.
 
Time a11::InfinitePast ()
 Returns the instant earlier than every finite time.
 
absl::StatusOr< std::int64_t > a11::DurationNanoseconds (Duration duration)
 Converts a duration to whole nanoseconds.
 
absl::StatusOr< std::int64_t > a11::TimeNanosecondsSinceEpoch (Time time)
 Converts an instant to nanoseconds since the Unix epoch.
 

Detailed Description

A11's time primitives: nanosecond-aware durations and instants.

A11 reuses Abseil's absl::Duration and absl::Time directly, so its time values carry Abseil's nanosecond resolution and its special infinite-past / infinite-future / infinite-duration sentinels. The free functions here provide named constructors for those sentinels and the current wall-clock time, plus lossless conversions to integer nanoseconds that fail (rather than truncate) on non-finite values.