From c0bc6059ca9ac7256c06deb5db0e8c3edf7a5b9f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 26 Sep 2015 16:19:56 -0400 Subject: [PATCH] ISO8601d: Added ::toJulian --- src/ISO8601.cpp | 6 ++++++ src/ISO8601.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/ISO8601.cpp b/src/ISO8601.cpp index b7f00aec2..a3eccc6fe 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; } +//////////////////////////////////////////////////////////////////////////////// +double ISO8601d::toJulian () +{ + return (_date / 86400.0) + 2440587.5; +} + //////////////////////////////////////////////////////////////////////////////// void ISO8601d::toMDY (int& m, int& d, int& y) { diff --git a/src/ISO8601.h b/src/ISO8601.h index ef55eafa5..b0aec7e6f 100644 --- a/src/ISO8601.h +++ b/src/ISO8601.h @@ -46,6 +46,7 @@ public: operator time_t () const; bool parse (const std::string&, std::string::size_type&, const std::string& format = ""); + double toJulian (); void toMDY (int&, int&, int&); ISO8601d startOfDay () const;