chromium/third_party/abseil-cpp/absl/time/civil_time.cc

// Copyright 2018 The Abseil 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
//
//      https://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.

#include "absl/time/civil_time.h"

#include <cstdlib>
#include <ostream>
#include <string>

#include "absl/strings/str_cat.h"
#include "absl/time/time.h"

namespace absl {
ABSL_NAMESPACE_BEGIN

namespace {

// Since a civil time has a larger year range than absl::Time (64-bit years vs
// 64-bit seconds, respectively) we normalize years to roughly +/- 400 years
// around the year 2400, which will produce an equivalent year in a range that
// absl::Time can handle.
inline civil_year_t NormalizeYear(civil_year_t year) {}

// Formats the given CivilSecond according to the given format.
std::string FormatYearAnd(string_view fmt, CivilSecond cs) {}

template <typename CivilT>
bool ParseYearAnd(string_view fmt, string_view s, CivilT* c) {}

// Tries to parse the type as a CivilT1, but then assigns the result to the
// argument of type CivilT2.
template <typename CivilT1, typename CivilT2>
bool ParseAs(string_view s, CivilT2* c) {}

template <typename CivilT>
bool ParseLenient(string_view s, CivilT* c) {}
}  // namespace

std::string FormatCivilTime(CivilSecond c) {}
std::string FormatCivilTime(CivilMinute c) {}
std::string FormatCivilTime(CivilHour c) {}
std::string FormatCivilTime(CivilDay c) {}
std::string FormatCivilTime(CivilMonth c) {}
std::string FormatCivilTime(CivilYear c) {}

bool ParseCivilTime(string_view s, CivilSecond* c) {}
bool ParseCivilTime(string_view s, CivilMinute* c) {}
bool ParseCivilTime(string_view s, CivilHour* c) {}
bool ParseCivilTime(string_view s, CivilDay* c) {}
bool ParseCivilTime(string_view s, CivilMonth* c) {}
bool ParseCivilTime(string_view s, CivilYear* c) {}

bool ParseLenientCivilTime(string_view s, CivilSecond* c) {}
bool ParseLenientCivilTime(string_view s, CivilMinute* c) {}
bool ParseLenientCivilTime(string_view s, CivilHour* c) {}
bool ParseLenientCivilTime(string_view s, CivilDay* c) {}
bool ParseLenientCivilTime(string_view s, CivilMonth* c) {}
bool ParseLenientCivilTime(string_view s, CivilYear* c) {}

namespace time_internal {

std::ostream& operator<<(std::ostream& os, CivilYear y) {}
std::ostream& operator<<(std::ostream& os, CivilMonth m) {}
std::ostream& operator<<(std::ostream& os, CivilDay d) {}
std::ostream& operator<<(std::ostream& os, CivilHour h) {}
std::ostream& operator<<(std::ostream& os, CivilMinute m) {}
std::ostream& operator<<(std::ostream& os, CivilSecond s) {}

bool AbslParseFlag(string_view s, CivilSecond* c, std::string*) {}
bool AbslParseFlag(string_view s, CivilMinute* c, std::string*) {}
bool AbslParseFlag(string_view s, CivilHour* c, std::string*) {}
bool AbslParseFlag(string_view s, CivilDay* c, std::string*) {}
bool AbslParseFlag(string_view s, CivilMonth* c, std::string*) {}
bool AbslParseFlag(string_view s, CivilYear* c, std::string*) {}
std::string AbslUnparseFlag(CivilSecond c) {}
std::string AbslUnparseFlag(CivilMinute c) {}
std::string AbslUnparseFlag(CivilHour c) {}
std::string AbslUnparseFlag(CivilDay c) {}
std::string AbslUnparseFlag(CivilMonth c) {}
std::string AbslUnparseFlag(CivilYear c) {}

}  // namespace time_internal

ABSL_NAMESPACE_END
}  // namespace absl