std::string GncDateTimeImpl::format_zulu(const char* format) const { using Facet = boost::posix_time::time_facet; std::stringstream ss; //The stream destructor frees the facet, so it must be heap-allocated. auto output_facet(new Facet(format)); ss.imbue(std::locale(std::locale(), output_facet)); ss << m_time.utc_time(); return ss.str(); }
std::unique_ptr<GncDateImpl> GncDateTimeImpl::date() const { return std::unique_ptr<GncDateImpl>(new GncDateImpl(m_time.local_time().date())); }
long GncDateTimeImpl::offset() const { auto offset = m_time.local_time() - m_time.utc_time(); return offset.total_seconds(); }