mirror of
https://github.com/HowardHinnant/date.git
synced 2024-12-27 16:41:04 +08:00
Optimize zoned_time streaming operator
This commit is contained in:
parent
4e2a7ac05b
commit
b1d507df79
7
tz.h
7
tz.h
@ -984,15 +984,14 @@ make_zoned(const std::string& name, const sys_time<Duration>& st)
|
||||
return {name, st};
|
||||
}
|
||||
|
||||
|
||||
template <class Duration>
|
||||
inline
|
||||
std::ostream&
|
||||
operator<<(std::ostream& os, const zoned_time<Duration>& t)
|
||||
{
|
||||
// this should not use two lookups!
|
||||
return os << floor<Duration>(t.zone_->to_local(t.tp_)) << ' '
|
||||
<< t.zone_->get_info(t.tp_).abbrev;
|
||||
auto i = t.zone_->get_info(t.tp_);
|
||||
auto lt = t.tp_ + i.offset;
|
||||
return os << lt << ' ' << i.abbrev;
|
||||
}
|
||||
|
||||
class utc_clock
|
||||
|
Loading…
x
Reference in New Issue
Block a user