summaryrefslogtreecommitdiff
path: root/times.cc
diff options
context:
space:
mode:
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