chromium/third_party/grpc/src/src/core/lib/gprpp/time.h

// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef GRPC_SRC_CORE_LIB_GPRPP_TIME_H
#define GRPC_SRC_CORE_LIB_GPRPP_TIME_H

#include <grpc/support/port_platform.h>

#include <stdint.h>

#include <limits>
#include <ostream>
#include <string>

#include "absl/types/optional.h"

#include <grpc/event_engine/event_engine.h>
#include <grpc/support/time.h>

#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gpr/useful.h"

#define GRPC_LOG_EVERY_N_SEC(n, severity, format, ...)

namespace grpc_core {

namespace time_detail {

inline int64_t MillisAdd(int64_t a, int64_t b) {}

constexpr inline int64_t MillisMul(int64_t millis, int64_t mul) {}

}  // namespace time_detail

class Duration;

// Timestamp represents a discrete point in time.
class Timestamp {};

class ScopedTimeCache final : public Timestamp::ScopedSource {};

// Duration represents a span of time.
class Duration {};

inline Duration operator+(Duration lhs, Duration rhs) {}

inline Duration operator-(Duration lhs, Duration rhs) {}

inline Timestamp operator+(Timestamp lhs, Duration rhs) {}

inline Timestamp operator-(Timestamp lhs, Duration rhs) {}

inline Timestamp operator+(Duration lhs, Timestamp rhs) {}

inline Duration operator-(Timestamp lhs, Timestamp rhs) {}

inline Duration operator*(Duration lhs, double rhs) {}

inline Duration operator*(double lhs, Duration rhs) {}

inline Duration operator/(Duration lhs, int64_t rhs) {}

inline Duration Duration::FromSecondsAndNanoseconds(int64_t seconds,
                                                    int32_t nanos) {}

inline Duration Duration::FromSecondsAsDouble(double seconds) {}

inline Duration& Duration::operator*=(double multiplier) {}

inline Timestamp& Timestamp::operator+=(Duration duration) {}

void TestOnlySetProcessEpoch(gpr_timespec epoch);

std::ostream& operator<<(std::ostream& out, Timestamp timestamp);
std::ostream& operator<<(std::ostream& out, Duration duration);

}  // namespace grpc_core

#endif  // GRPC_SRC_CORE_LIB_GPRPP_TIME_H