Optimize zoned_time streaming operator

This commit is contained in:
Howard Hinnant 2016-05-06 22:48:36 -04:00
parent 4e2a7ac05b
commit b1d507df79

7
tz.h
View File

@ -984,15 +984,14 @@ make_zoned(const std::string& name, const sys_time<Duration>& st)
return {name, st}; return {name, st};
} }
template <class Duration> template <class Duration>
inline inline
std::ostream& std::ostream&
operator<<(std::ostream& os, const zoned_time<Duration>& t) operator<<(std::ostream& os, const zoned_time<Duration>& t)
{ {
// this should not use two lookups! auto i = t.zone_->get_info(t.tp_);
return os << floor<Duration>(t.zone_->to_local(t.tp_)) << ' ' auto lt = t.tp_ + i.offset;
<< t.zone_->get_info(t.tp_).abbrev; return os << lt << ' ' << i.abbrev;
} }
class utc_clock class utc_clock