diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/local_time.cc | 17 | ||||
| -rw-r--r-- | src/local_time.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/local_time.cc b/src/local_time.cc index ed809d49..6a8579ff 100644 --- a/src/local_time.cc +++ b/src/local_time.cc @@ -217,6 +217,23 @@ LocalTime::time_of_day (bool with_second, bool with_millisecond) const return buffer; } + +void +LocalTime::add_days (int days) +{ + using namespace boost; + + gregorian::date d (_year, _month, _day); + if (days > 0) { + d += gregorian::days (days); + } else { + d -= gregorian::days (-days); + } + + set (posix_time::ptime(d, posix_time::time_duration(_hour, _minute, _second, _millisecond * 1000))); +} + + void LocalTime::add_months (int m) { diff --git a/src/local_time.h b/src/local_time.h index 310c598c..e818ba6e 100644 --- a/src/local_time.h +++ b/src/local_time.h @@ -83,6 +83,7 @@ public: _year = y; } + void add_days (int d); void add_months (int a); void add_minutes (int a); |
