Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "absl/time/internal/cctz/include/cctz/civil_time_detail.h"
00016
00017 #include <iomanip>
00018 #include <ostream>
00019 #include <sstream>
00020
00021 namespace absl {
00022 namespace time_internal {
00023 namespace cctz {
00024 namespace detail {
00025
00026
00027
00028
00029 std::ostream& operator<<(std::ostream& os, const civil_year& y) {
00030 std::stringstream ss;
00031 ss << y.year();
00032 return os << ss.str();
00033 }
00034 std::ostream& operator<<(std::ostream& os, const civil_month& m) {
00035 std::stringstream ss;
00036 ss << civil_year(m) << '-';
00037 ss << std::setfill('0') << std::setw(2) << m.month();
00038 return os << ss.str();
00039 }
00040 std::ostream& operator<<(std::ostream& os, const civil_day& d) {
00041 std::stringstream ss;
00042 ss << civil_month(d) << '-';
00043 ss << std::setfill('0') << std::setw(2) << d.day();
00044 return os << ss.str();
00045 }
00046 std::ostream& operator<<(std::ostream& os, const civil_hour& h) {
00047 std::stringstream ss;
00048 ss << civil_day(h) << 'T';
00049 ss << std::setfill('0') << std::setw(2) << h.hour();
00050 return os << ss.str();
00051 }
00052 std::ostream& operator<<(std::ostream& os, const civil_minute& m) {
00053 std::stringstream ss;
00054 ss << civil_hour(m) << ':';
00055 ss << std::setfill('0') << std::setw(2) << m.minute();
00056 return os << ss.str();
00057 }
00058 std::ostream& operator<<(std::ostream& os, const civil_second& s) {
00059 std::stringstream ss;
00060 ss << civil_minute(s) << ':';
00061 ss << std::setfill('0') << std::setw(2) << s.second();
00062 return os << ss.str();
00063 }
00064
00066
00067 std::ostream& operator<<(std::ostream& os, weekday wd) {
00068 switch (wd) {
00069 case weekday::monday:
00070 return os << "Monday";
00071 case weekday::tuesday:
00072 return os << "Tuesday";
00073 case weekday::wednesday:
00074 return os << "Wednesday";
00075 case weekday::thursday:
00076 return os << "Thursday";
00077 case weekday::friday:
00078 return os << "Friday";
00079 case weekday::saturday:
00080 return os << "Saturday";
00081 case weekday::sunday:
00082 return os << "Sunday";
00083 }
00084 return os;
00085 }
00086
00087 }
00088 }
00089 }
00090 }