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};
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user