A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
Loading...
Searching...
No Matches
time.h
Go to the documentation of this file.
1// Copyright 2026 The A11 Authors.
2
15#ifndef A11_TIME_H_
16#define A11_TIME_H_
17
18#include <cstdint>
19
20#include <absl/status/statusor.h>
21#include <absl/time/time.h>
22
23namespace a11 {
24
26using Duration = absl::Duration;
28using Time = absl::Time;
29
35Time Now();
40
47absl::StatusOr<std::int64_t> DurationNanoseconds(Duration duration);
54absl::StatusOr<std::int64_t> TimeNanosecondsSinceEpoch(Time time);
55
56} // namespace a11
57
58#endif // A11_TIME_H_
Definition action.cc:46
absl::StatusOr< std::int64_t > TimeNanosecondsSinceEpoch(Time time)
Converts an instant to nanoseconds since the Unix epoch.
Definition time.cc:44
Duration InfiniteDuration()
Returns the duration greater than every finite duration.
Definition time.cc:16
Time InfinitePast()
Returns the instant earlier than every finite time.
Definition time.cc:28
Time Now()
Returns the current wall-clock time from Abseil's clock.
Definition time.cc:20
Duration ZeroDuration()
Returns the zero duration.
Definition time.cc:12
absl::StatusOr< std::int64_t > DurationNanoseconds(Duration duration)
Converts a duration to whole nanoseconds.
Definition time.cc:32
Time InfiniteFuture()
Returns the instant later than every finite time.
Definition time.cc:24
absl::Duration Duration
A11 duration; an alias of absl::Duration (nanosecond-aware).
Definition time.h:26
absl::Time Time
A11 instant; an alias of absl::Time (nanosecond-aware).
Definition time.h:28
Future< T > SubmitWithCancellationHook(absl::AnyInvocable< absl::StatusOr< T >() && > work, std::function< void()> cancellation_hook, thread::TreeOptions tree_options)
Run work on A11's fiber pool with application-specific cancellation.
Definition executor.h:30