From 0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 19 Apr 2007 20:31:46 +0000 Subject: 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. --- times.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'times.cc') 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 +#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 -- cgit v1.2.3