A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
time.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 The A11 Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
29#ifndef A11_TIME_H_
30#define A11_TIME_H_
31
32#include <cstdint>
33
34#include <absl/status/statusor.h>
35#include <absl/time/time.h>
36
37namespace a11 {
38
40using Duration = absl::Duration;
42using Time = absl::Time;
43
49Time Now();
54
61absl::StatusOr<std::int64_t> DurationNanoseconds(Duration duration);
68absl::StatusOr<std::int64_t> TimeNanosecondsSinceEpoch(Time time);
69
70} // namespace a11
71
72#endif // A11_TIME_H_
Definition action.cc:63
absl::StatusOr< std::int64_t > TimeNanosecondsSinceEpoch(Time time)
Converts an instant to nanoseconds since the Unix epoch.
Definition time.cc:56
Duration InfiniteDuration()
Returns the duration greater than every finite duration.
Definition time.cc:28
Time InfinitePast()
Returns the instant earlier than every finite time.
Definition time.cc:40
Time Now()
Returns the current wall-clock time from Abseil's clock.
Definition time.cc:32
Duration ZeroDuration()
Returns the zero duration.
Definition time.cc:24
absl::StatusOr< std::int64_t > DurationNanoseconds(Duration duration)
Converts a duration to whole nanoseconds.
Definition time.cc:44
Time InfiniteFuture()
Returns the instant later than every finite time.
Definition time.cc:36
absl::Duration Duration
A11 duration; an alias of absl::Duration (nanosecond-aware).
Definition time.h:40
absl::Time Time
A11 instant; an alias of absl::Time (nanosecond-aware).
Definition time.h:42