-// 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 //
#include <anna/core/tracing/Logger.hpp>
//------------------------------------------------------------------------------
//----------------------------------------------------------- Date::initialize()
//------------------------------------------------------------------------------
-void Date::initialize(const char * TZ) throw() {
+void Date::initialize(const char * TZ) {
a_timestamp = ::time(NULL);
setTz(TZ);
}
//------------------------------------------------------------------------------
//-------------------------------------------------------------- Date::refresh()
//------------------------------------------------------------------------------
-void Date::refresh(void) throw() {
+void Date::refresh(void) {
anna::Guard guard(a_mutex);
// Set current/programmed timezone
//------------------------------------------------------------------------------
//---------------------------------------------------------------- Date::setTz()
//------------------------------------------------------------------------------
-void Date::setTz(const char * TZ) throw() {
+void Date::setTz(const char * TZ) {
if (TZ) a_tz.set(TZ);
else a_tz = functions::getSystemTimezone();
//------------------------------------------------------------------------------
//---------------------------------------------------- Date::setSystemTimezone()
//------------------------------------------------------------------------------
-void Date::setSystemTimezone() throw() {
+void Date::setSystemTimezone() {
a_tz = functions::getSystemTimezone();
// Refresh the other data:
refresh();
//------------------------------------------------------------------------------
//---------------------------------------------------------------- Date::store()
//------------------------------------------------------------------------------
-void Date::store(const time_t & unixTimestamp) throw() {
+void Date::store(const time_t & unixTimestamp) {
a_timestamp = unixTimestamp;
// Refresh the other data:
refresh();
//------------------------------------------------------------------------------
//------------------------------------------------------------- Date::storeNtp()
//------------------------------------------------------------------------------
-void Date::storeNtp(const unsigned int & ntpTimestamp) throw() {
+void Date::storeNtp(const unsigned int & ntpTimestamp) {
a_timestamp = ntpTimestamp - TIMESTAMP_OFFSET_NTP1900_OVER_UNIX1970;
// Refresh the other data:
refresh();
//------------------------------------------------------------------------------
void Date::store(const struct tm &date, const char *TZ)
-throw(anna::RuntimeException)
+noexcept(false)
{
if (TZ) {
//---------------------------------------------------------------- Date::store()
//------------------------------------------------------------------------------
void Date::store(const std::string &stringDate, const char *TZ, const char *strptimeFormat)
-throw(anna::RuntimeException)
+noexcept(false)
{
if(strptimeFormat == NULL)
throw anna::RuntimeException("Invalid NULL strptimeFormat !!", ANNA_FILE_LOCATION);
//------------------------------------------------------------------------------
//--------------------------------------------------------------- Date::getDay()
//------------------------------------------------------------------------------
-const char *Date::getDay(void) const throw() {
+const char *Date::getDay(void) const {
static const char *weekdayname[] = {"Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday"};
//------------------------------------------------------------------------------
//------------------------------------------------------- Date::yyyymmddHHmmss()
//------------------------------------------------------------------------------
-std::string Date::yyyymmddHHmmss(void) const throw() {
+std::string Date::yyyymmddHHmmss(void) const {
return anna::functions::asString("%04d%02d%02d%02d%02d%02d",
1900 + a_tm.tm_year, 1 + (a_tm.tm_mon), a_tm.tm_mday,
a_tm.tm_hour, a_tm.tm_min, a_tm.tm_sec);
//------------------------------------------------------------------------------
//------------------------------------------------------------- Date::asString()
//------------------------------------------------------------------------------
-std::string Date::asString(void) const throw() {
+std::string Date::asString(void) const {
std::string result = anna::functions::asString("%s %02d/%02d/%04d %02d:%02d:%02d ", getDay(),
getTm().tm_mday, 1 + (getTm().tm_mon), 1900 + getTm().tm_year,
//------------------------------------------------------------------------------
//---------------------------------------------------------------- Date::asXML()
//------------------------------------------------------------------------------
-anna::xml::Node* Date::asXML(anna::xml::Node* parent) const throw() {
+anna::xml::Node* Date::asXML(anna::xml::Node* parent) const {
//anna::xml::Node* result = parent->createChild("anna.time.Date");
parent->createAttribute("Date", anna::functions::asString("%02d/%02d/%04d", getTm().tm_mday, 1 + (getTm().tm_mon), 1900 + getTm().tm_year));
parent->createAttribute("Day", getDay());