diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-09 13:25:45 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-09 13:25:45 -0500 |
commit | 865c0ff828f88ed1d00eea73a3fc55b3e57d21b3 (patch) | |
tree | 5acdfae32811b25fb46271bf349a216bea41fddb /src/times.h | |
parent | 55c7792c9329f97dd19fc5aeca466cb2de4fbf9c (diff) | |
parent | 9b396b41220646cf73fcd2a8afebcee06dde2a29 (diff) | |
download | fork-ledger-865c0ff828f88ed1d00eea73a3fc55b3e57d21b3.tar.gz fork-ledger-865c0ff828f88ed1d00eea73a3fc55b3e57d21b3.tar.bz2 fork-ledger-865c0ff828f88ed1d00eea73a3fc55b3e57d21b3.zip |
Merge branch 'next'
Diffstat (limited to 'src/times.h')
-rw-r--r-- | src/times.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/times.h b/src/times.h index 9387320e..3cd359d2 100644 --- a/src/times.h +++ b/src/times.h @@ -116,6 +116,28 @@ std::string format_date(const date_t& when, void set_date_format(const char * format); void set_input_date_format(const char * format); +inline void to_xml(std::ostream& out, const datetime_t& when, + bool wrap = true) +{ + if (wrap) { + push_xml x(out, "datetime"); + out << format_datetime(when, FMT_WRITTEN); + } else { + out << format_datetime(when, FMT_WRITTEN); + } +} + +inline void to_xml(std::ostream& out, const date_t& when, + bool wrap = true) +{ + if (wrap) { + push_xml x(out, "date"); + out << format_date(when, FMT_WRITTEN); + } else { + out << format_date(when, FMT_WRITTEN); + } +} + class date_interval_t : public equality_comparable<date_interval_t> { public: |