diff options
Diffstat (limited to 'absl/time/civil_time.h')
-rw-r--r-- | absl/time/civil_time.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/absl/time/civil_time.h b/absl/time/civil_time.h index f6cc3ff8..f0be303c 100644 --- a/absl/time/civil_time.h +++ b/absl/time/civil_time.h @@ -4,7 +4,7 @@ // 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 +// 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, @@ -66,7 +66,6 @@ // // // Valid in C++14 // constexpr absl::CivilDay cd(1969, 07, 20); -// #ifndef ABSL_TIME_CIVIL_TIME_H_ #define ABSL_TIME_CIVIL_TIME_H_ @@ -77,7 +76,7 @@ #include "absl/time/internal/cctz/include/cctz/civil_time.h" namespace absl { -inline namespace lts_2018_12_18 { +inline namespace lts_2019_08_08 { namespace time_internal { struct second_tag : cctz::detail::second_tag {}; @@ -372,15 +371,15 @@ using Weekday = time_internal::cctz::weekday; // GetWeekday() // -// Returns the absl::Weekday for the given absl::CivilDay. +// Returns the absl::Weekday for the given (realigned) civil-time value. // // Example: // // absl::CivilDay a(2015, 8, 13); // absl::Weekday wd = absl::GetWeekday(a); // wd == absl::Weekday::thursday // -inline Weekday GetWeekday(CivilDay cd) { - return time_internal::cctz::get_weekday(cd); +inline Weekday GetWeekday(CivilSecond cs) { + return time_internal::cctz::get_weekday(cs); } // NextWeekday() @@ -409,9 +408,9 @@ inline Weekday GetWeekday(CivilDay cd) { // // absl::CivilDay d = ... // // Gets the following Thursday if d is not already Thursday -// absl::CivilDay thurs1 = absl::PrevWeekday(d, absl::Weekday::thursday) + 7; +// absl::CivilDay thurs1 = absl::NextWeekday(d - 1, absl::Weekday::thursday); // // Gets the previous Thursday if d is not already Thursday -// absl::CivilDay thurs2 = absl::NextWeekday(d, absl::Weekday::thursday) - 7; +// absl::CivilDay thurs2 = absl::PrevWeekday(d + 1, absl::Weekday::thursday); // inline CivilDay NextWeekday(CivilDay cd, Weekday wd) { return CivilDay(time_internal::cctz::next_weekday(cd, wd)); @@ -422,7 +421,7 @@ inline CivilDay PrevWeekday(CivilDay cd, Weekday wd) { // GetYearDay() // -// Returns the day-of-year for the given absl::CivilDay. +// Returns the day-of-year for the given (realigned) civil-time value. // // Example: // @@ -431,8 +430,8 @@ inline CivilDay PrevWeekday(CivilDay cd, Weekday wd) { // absl::CivilDay b(2015, 12, 31); // int yd_dec_31 = absl::GetYearDay(b); // yd_dec_31 = 365 // -inline int GetYearDay(CivilDay cd) { - return time_internal::cctz::get_yearday(cd); +inline int GetYearDay(CivilSecond cs) { + return time_internal::cctz::get_yearday(cs); } // FormatCivilTime() @@ -452,7 +451,7 @@ inline int GetYearDay(CivilDay cd) { // Example: // // absl::CivilDay d = absl::CivilDay(1969, 7, 20); -// string day_string = absl::FormatCivilTime(d); // "1969-07-20" +// std::string day_string = absl::FormatCivilTime(d); // "1969-07-20" // std::string FormatCivilTime(CivilSecond c); std::string FormatCivilTime(CivilMinute c); @@ -482,7 +481,7 @@ std::ostream& operator<<(std::ostream& os, CivilSecond s); } // namespace time_internal -} // inline namespace lts_2018_12_18 +} // inline namespace lts_2019_08_08 } // namespace absl #endif // ABSL_TIME_CIVIL_TIME_H_ |