diff options
author | John Wiegley <johnw@newartisans.com> | 2005-02-16 05:52:04 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:41:03 -0400 |
commit | e6a0e8623547a2d3a0cfa2a64d68b49254960636 (patch) | |
tree | 0d61c68d4bb4ee517258e928ea7400d95c380868 /datetime.cc | |
parent | 230143478ad6f5429aff75efd835de70d92b1bf5 (diff) | |
download | fork-ledger-e6a0e8623547a2d3a0cfa2a64d68b49254960636.tar.gz fork-ledger-e6a0e8623547a2d3a0cfa2a64d68b49254960636.tar.bz2 fork-ledger-e6a0e8623547a2d3a0cfa2a64d68b49254960636.zip |
(export_datetime): Exposed "parse_date" function.
Diffstat (limited to 'datetime.cc')
-rw-r--r-- | datetime.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/datetime.cc b/datetime.cc index 18e67501..685939aa 100644 --- a/datetime.cc +++ b/datetime.cc @@ -400,6 +400,22 @@ std::time_t interval_getitem(interval_t& interval, int i) return last_moment; } +std::time_t py_parse_date(const char * date_str) +{ + std::time_t temp; + if (parse_date(date_str, &temp)) + return temp; + return 0; +} + +std::time_t py_parse_date_yr(const char * date_str, const int year) +{ + std::time_t temp; + if (parse_date(date_str, &temp, year)) + return temp; + return 0; +} + void export_datetime() { class_< interval_t > @@ -418,6 +434,9 @@ void export_datetime() .def("increment", &interval_t::increment) ; + + def("parse_date", py_parse_date); + def("parse_date", py_parse_date_yr); } #endif // USE_BOOST_PYTHON |