diff options
author | John Wiegley <johnw@newartisans.com> | 2008-07-17 06:19:40 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-07-17 06:19:40 -0400 |
commit | 95f323f1378414080149b6ce535bb0f1918c7b35 (patch) | |
tree | 9c1eb04eefca4a4d1b358456d72f8e1c5fcfc6fa /datetime.cc | |
parent | f482d120fd648bdb137a1f3f9517e30095f8c38a (diff) | |
download | fork-ledger-95f323f1378414080149b6ce535bb0f1918c7b35.tar.gz fork-ledger-95f323f1378414080149b6ce535bb0f1918c7b35.tar.bz2 fork-ledger-95f323f1378414080149b6ce535bb0f1918c7b35.zip |
Added several more date/time fixes from Nathan Jones. Fixes #49.
Diffstat (limited to 'datetime.cc')
-rw-r--r-- | datetime.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/datetime.cc b/datetime.cc index 434660cd..2b9ddddf 100644 --- a/datetime.cc +++ b/datetime.cc @@ -16,10 +16,13 @@ std::string date_t::input_format; std::string date_t::output_format = "%Y/%m/%d"; const char * date_t::formats[] = { + "%y/%m/%d", "%Y/%m/%d", "%m/%d", + "%y.%m.%d", "%Y.%m.%d", "%m.%d", + "%y-%m-%d", "%Y-%m-%d", "%m-%d", "%a", @@ -349,7 +352,7 @@ namespace { when.tm_sec = 0; if (when.tm_year == -1) - when.tm_year = ((year == -1) ? date_t::current_year : (year - 1900)); + when.tm_year = ((year == -1) ? date_t::current_year : year) - 1900; if (when.tm_mon == -1) when.tm_mon = 0; @@ -364,6 +367,6 @@ namespace { bool quick_parse_date(const char * date_str, std::time_t * result) { - return parse_date(date_str, result, date_t::current_year + 1900); + return parse_date(date_str, result, date_t::current_year); } } |