39 std::stringstream
strm;
41 strm <<
"Daylight Savings = " <<
t.tm_isdst
42 <<
"\nDay of year = " <<
t.tm_yday
43 <<
"\nDay of week = " <<
t.tm_wday
44 <<
"\nYear = " <<
t.tm_year
45 <<
"\nMonth = " <<
t.tm_mon
46 <<
"\nDay of month = " <<
t.tm_mday
47 <<
"\nHour = " <<
t.tm_hour
48 <<
"\nMinute = " <<
t.tm_min
49 <<
"\nSecond = " <<
t.tm_sec
53 const std::ostream::sentry guard (
os);
56 os.rdbuf ()->sputn (
strm.str ().c_str (),
strm.str ().size ());
58 os.setstate (
os.failbit);
66 typedef std::istreambuf_iterator<char, std::char_traits<char> >
Iter;
72 std::ios_base::iostate state;
75 std::istringstream ins (
"");
81 const std::locale
loc (
"C");
84 const std::time_get<char, Iter> &tg =
85 std::use_facet<std::time_get<char, Iter> >(
loc);
88 std::cout <<
"time_base::dateorder == " << tg.date_order () <<
".\n";
94 tg.get_date (begin,
end, ins, state, &timeb);
95 std::cout <<
"Date: Apr 7 1969\n" << timeb << std::endl;
101 tg.get_weekday (begin,
end, ins, state, &timeb);
102 std::cout <<
"Weekday: Monday\n" << timeb << std::endl;
105 ins.str (
"06:47:32");
108 tg.get_time (begin,
end, ins, state, &timeb);
109 std::cout <<
"Time: 06:47:32\n" << timeb << std::endl;
std::ostream_iterator< int, char, std::char_traits< char > > Iter
std::ostream & operator<<(std::ostream &os, const std::tm &t)