From 236738c708a851d50e0c1378b088e4ebefa9d191 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 12 Jun 2011 13:23:13 -0400 Subject: [PATCH] Date Processing - Dates now support 'j' and 'J' julian day format. --- src/Date.cpp | 14 ++++++++++++++ src/Date.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/Date.cpp b/src/Date.cpp index 9d6b1f2b0..9b0f0776a 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -537,6 +537,20 @@ bool Date::valid (const int m, const int d, const int y) return true; } +//////////////////////////////////////////////////////////////////////////////// +// Julian +bool Date::valid (const int d, const int y) +{ + // Check that the year is valid. + if (y < 0) + return false; + + if (d < 0 || d > 365) + return false; + + return true; +} + //////////////////////////////////////////////////////////////////////////////// bool Date::leapYear (int year) { diff --git a/src/Date.h b/src/Date.h index 48d902b0a..7124536e1 100644 --- a/src/Date.h +++ b/src/Date.h @@ -60,6 +60,7 @@ public: static bool valid (const std::string&, const std::string& format = "m/d/Y"); static bool valid (const int, const int, const int, const int, const int, const int); static bool valid (const int, const int, const int); + static bool valid (const int, const int); static time_t easter (int year); static bool leapYear (int);