summaryrefslogtreecommitdiff
path: root/src/times.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-27 22:26:13 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-27 22:26:13 -0400
commit58fb65421829de49a3b27800ce54e093d45f0f41 (patch)
tree18fb188d4bfb45677ec0a660f0b6cd5019601621 /src/times.h
parent3c30f74931bbe94484da82481eb9d3b788347907 (diff)
parent6c9cf1237e1e813c2d56ed51a38cc0685614e8e0 (diff)
downloadfork-ledger-58fb65421829de49a3b27800ce54e093d45f0f41.tar.gz
fork-ledger-58fb65421829de49a3b27800ce54e093d45f0f41.tar.bz2
fork-ledger-58fb65421829de49a3b27800ce54e093d45f0f41.zip
Merge branch 'next'
Diffstat (limited to 'src/times.h')
-rw-r--r--src/times.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/times.h b/src/times.h
index c77cde1d..035d86cd 100644
--- a/src/times.h
+++ b/src/times.h
@@ -66,12 +66,17 @@ inline bool is_valid(const date_t& moment) {
return ! moment.is_not_a_date();
}
+extern optional<datetime_t> epoch;
+
#ifdef BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK
-#define CURRENT_TIME() boost::posix_time::microsec_clock::universal_time()
+#define CURRENT_TIME() \
+ (epoch ? *epoch : boost::posix_time::microsec_clock::universal_time())
#else
-#define CURRENT_TIME() boost::posix_time::second_clock::universal_time()
+#define CURRENT_TIME() \
+ (epoch ? *epoch : boost::posix_time::second_clock::universal_time())
#endif
-#define CURRENT_DATE() boost::gregorian::day_clock::universal_day()
+#define CURRENT_DATE() \
+ (epoch ? epoch->date() : boost::gregorian::day_clock::universal_day())
extern date_time::weekdays start_of_week;