X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Ftime%2FDate.hpp;h=c661419c2040f62d79f787cc9aa652785ecff2ca;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hp=f0a46be13adfc6debcd0f1d0b9e8f11f507f3f8b;hpb=b8c96c2917b9d29976a8771659d70bfb0881c133;p=anna.git diff --git a/include/anna/time/Date.hpp b/include/anna/time/Date.hpp index f0a46be..c661419 100644 --- a/include/anna/time/Date.hpp +++ b/include/anna/time/Date.hpp @@ -1,37 +1,9 @@ -// ANNA - Anna is Not Nothingness Anymore -// -// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo -// -// https://bitbucket.org/testillano/anna -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Authors: eduardo.ramos.testillano@gmail.com -// cisco.tierra@gmail.com +// ANNA - Anna is Not Nothingness Anymore // +// // +// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo // +// // +// See project site at http://redmine.teslayout.com/projects/anna-suite // +// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE // #ifndef anna_time_Date_hpp @@ -150,10 +122,10 @@ class Date { // sets the current date/time (time(NULL)) and provided TimeZone as described in constructor - void initialize(const char *TZ = NULL) throw(); + void initialize(const char *TZ = NULL) ; // main refresh method regarding timestamp - void refresh(void) throw(); + void refresh(void) ; anna::Mutex a_mutex; @@ -182,7 +154,7 @@ public: /** * Sets the current date/time (time(NULL)) and provided TimeZone as described in constructor */ - void setNow(const char *TZ = NULL) throw() { initialize(TZ); } + void setNow(const char *TZ = NULL) { initialize(TZ); } /** @@ -201,13 +173,13 @@ public: * timezone, only helps to know the valid TZ values and shows how to change * the timezone settings if you would want to do that). */ - void setTz(const char *TZ = NULL) throw(); + void setTz(const char *TZ = NULL) ; /** Sets the local host timezone (even if it is based on TZ or in /usr/share/zoneinfo) */ - void setSystemTimezone() throw(); + void setSystemTimezone() ; /** @@ -215,8 +187,8 @@ public: * * @param unixTimestamp Time since 01-Jan-1970 GMT */ - void store(const time_t & unixTimestamp) throw(); - void storeUnix(const time_t & unixTimestamp) throw() { store(unixTimestamp); } + void store(const time_t & unixTimestamp) ; + void storeUnix(const time_t & unixTimestamp) { store(unixTimestamp); } /** @@ -224,7 +196,7 @@ public: * * @param ntpTimestamp Time since 01-Jan-1900 GMT */ - void storeNtp(const unsigned int &ntpTimestamp) throw(); + void storeNtp(const unsigned int &ntpTimestamp) ; /** @@ -234,7 +206,7 @@ public: * @param TZ timezone for date/time provided. Default (NULL) assumes the system * timezone configuration. Empty string will be interpreted as UTC timezone. */ - void store(const struct tm &date, const char *TZ = NULL) throw(anna::RuntimeException); + void store(const struct tm &date, const char *TZ = NULL) noexcept(false); /** @@ -247,8 +219,8 @@ public: * @param strptimeFormat Date/time string format for strptime primitive. * See format syntax at http://man7.org/linux/man-pages/man3/strptime.3.html */ - void store(const std::string &stringDate, const char *TZ = NULL, const char *strptimeFormat = "%Y%m%d%H%M%S") throw(anna::RuntimeException); - //void store(const std::string &stringDate, const char *tz = NULL, const char *strptimeFormat = "%Y-%m-%d-%H-%M-%S") throw(anna::RuntimeException); + void store(const std::string &stringDate, const char *TZ = NULL, const char *strptimeFormat = "%Y%m%d%H%M%S") noexcept(false); + //void store(const std::string &stringDate, const char *tz = NULL, const char *strptimeFormat = "%Y-%m-%d-%H-%M-%S") noexcept(false); /** @@ -319,13 +291,13 @@ public: * @return NULL if TZ is unset, or string for TZ environment variable * (empty is allowed and use to be understood as UTC. */ - const char *getTz(void) const throw() { return (a_tz.unsetTZ() ? NULL:a_tz.getValue().c_str()); } + const char *getTz(void) const { return (a_tz.unsetTZ() ? NULL:a_tz.getValue().c_str()); } /** * Gets the context timezone as string */ - std::string getTzAsString() const throw() { return a_tz.asString(); } + std::string getTzAsString() const { return a_tz.asString(); } /** @@ -333,14 +305,14 @@ public: * * @return 'tm' struct on the current timezone */ - const struct tm & getTm(void) const throw() { return a_tm; } + const struct tm & getTm(void) const { return a_tm; } /** * Gets the week day abbreviation: Sun, Mon, Tue, Wed, Thu, Fri, Sat * * @return Day of the week */ - const char *getDay(void) const throw(); + const char *getDay(void) const ; /** @@ -350,7 +322,7 @@ public: * * @see getTz */ - std::string yyyymmddHHmmss(void) const throw(); + std::string yyyymmddHHmmss(void) const ; /** @@ -358,7 +330,7 @@ public: * * @return Seconds since 01-Jan-1970 GMT */ - const time_t & getUnixTimestamp(void) const throw() { return a_timestamp; } + const time_t & getUnixTimestamp(void) const { return a_timestamp; } /** @@ -366,7 +338,7 @@ public: * * @return Seconds since 01-Jan-1900 GMT */ - unsigned int getNtpTimestamp(void) const throw() { + unsigned int getNtpTimestamp(void) const { unsigned int ntp_timestamp = a_timestamp + TIMESTAMP_OFFSET_NTP1900_OVER_UNIX1970; return ntp_timestamp; } @@ -377,7 +349,7 @@ public: * * @return String with class content */ - std::string asString(void) const throw(); + std::string asString(void) const ; /** @@ -385,7 +357,7 @@ public: * * @return XML with class content */ - anna::xml::Node* asXML(anna::xml::Node* parent) const throw(); + anna::xml::Node* asXML(anna::xml::Node* parent) const ; };