From b1d507df79bcef9761e50f9002a65fdccea525de Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Fri, 6 May 2016 22:48:36 -0400 Subject: [PATCH] Optimize zoned_time streaming operator --- tz.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tz.h b/tz.h index b28f2bd..77f2282 100644 --- a/tz.h +++ b/tz.h @@ -984,15 +984,14 @@ make_zoned(const std::string& name, const sys_time& st) return {name, st}; } - template inline std::ostream& operator<<(std::ostream& os, const zoned_time& t) { - // this should not use two lookups! - return os << floor(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