summaryrefslogtreecommitdiff
path: root/times.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-04-19 20:31:46 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:28 -0400
commit0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c (patch)
tree0a2c2aca7100d045f491b03f0a5bda92378d3ef9 /times.cc
parent176b3044e355398a0c31e0c42a3cd7b8a2e3f3e5 (diff)
downloadfork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.tar.gz
fork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.tar.bz2
fork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.zip
Made the amount/balance/value interface a bit more rational; added
back a useless version of the register command (just to prove the command sequence); and added smart XML semantics to the XPath implementation so that nodes can be coerced to values.
Diffstat (limited to 'times.cc')
-rw-r--r--times.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/times.cc b/times.cc
index bb75f8d9..e6d0540f 100644
--- a/times.cc
+++ b/times.cc
@@ -1,12 +1,26 @@
+#ifdef HAVE_LANGINFO_H
+#include <langinfo.h>
+#endif
+
#include "times.h"
namespace ledger {
ptime now = boost::posix_time::second_clock::universal_time();
-bool day_before_month = false;
+
+bool day_before_month = false;
+static bool day_before_month_initialized = false;
ptime parse_datetime(std::istream& in)
{
+ if (! day_before_month_initialized) {
+#ifdef HAVE_NL_LANGINFO
+ const char * d_fmt = nl_langinfo(D_FMT);
+ if (d_fmt && std::strlen(d_fmt) > 1 && d_fmt[1] == 'd')
+ day_before_month = true;
+ day_before_month_initialized = true;
+#endif
+ }
#if 1
return parse_abs_datetime(in);
#else