diff options
Diffstat (limited to 'times.cc')
-rw-r--r-- | times.cc | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -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 |