From af81b24d9252da76b33988f310146b99ca814b6d Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 26 Sep 2015 14:21:42 -0400 Subject: [PATCH] ISO8601d: Added ::year --- src/ISO8601.cpp | 7 +++++++ src/ISO8601.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/ISO8601.cpp b/src/ISO8601.cpp index e01df077b..b1ca9eedf 100644 --- a/src/ISO8601.cpp +++ b/src/ISO8601.cpp @@ -926,6 +926,13 @@ int ISO8601d::day () const return t->tm_mday; } +//////////////////////////////////////////////////////////////////////////////// +int ISO8601d::year () const +{ + struct tm* t = localtime (&_date); + return t->tm_year + 1900; +} + //////////////////////////////////////////////////////////////////////////////// void ISO8601p::clear () { diff --git a/src/ISO8601.h b/src/ISO8601.h index 4e6e9a72d..3563bd5b8 100644 --- a/src/ISO8601.h +++ b/src/ISO8601.h @@ -56,6 +56,7 @@ public: int month () const; int week () const; int day () const; + int year () const; private: void clear ();