From 9c9216acbf6b4daefd16a249cab9aec565fc2ab1 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 26 Sep 2015 16:01:30 -0400 Subject: [PATCH] ISO8601d: Added ::startOfDay --- src/ISO8601.cpp | 6 ++++++ src/ISO8601.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ISO8601.cpp b/src/ISO8601.cpp index d6c0e73e7..6fa9df6c1 100644 --- a/src/ISO8601.cpp +++ b/src/ISO8601.cpp @@ -840,6 +840,12 @@ bool ISO8601p::parse (const std::string& input, std::string::size_type& start) return false; } +//////////////////////////////////////////////////////////////////////////////// +ISO8601d ISO8601d::startOfDay () const +{ + return ISO8601d (month (), day (), year ()); +} + //////////////////////////////////////////////////////////////////////////////// // Static bool ISO8601d::leapYear (int year) diff --git a/src/ISO8601.h b/src/ISO8601.h index 559794f4e..d4cd49768 100644 --- a/src/ISO8601.h +++ b/src/ISO8601.h @@ -43,10 +43,11 @@ public: ISO8601d (const int, const int, const int, const int, const int, const int); ~ISO8601d (); ISO8601d (const ISO8601d&); // Unimplemented - ISO8601d& operator= (const ISO8601d&); // Unimplemented operator time_t () const; bool parse (const std::string&, std::string::size_type&, const std::string& format = ""); + ISO8601d startOfDay () const; + static bool leapYear (int); static int daysInMonth (int, int); static int daysInYear (int);