From: Christian P. <cp...@us...> - 2004-12-27 05:22:02
|
Update of /cvsroot/pclasses/pclasses2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27697/src Added Files: DateTime.cpp Log Message: Added DateTime class --- NEW FILE: DateTime.cpp --- /*************************************************************************** * Copyright (C) 2004 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "pclasses/DateTime.h" namespace P { DateTime::DateTime() : Date(), Time(), _tzname() { } DateTime::DateTime(const Date& d, const Time& t, const std::string& tzname) : Date(d), Time(t), _tzname(tzname) { } DateTime::~DateTime() { } const std::string& DateTime::timeZone() const throw() { return _tzname; } void DateTime::setTimeZone(const std::string& tzname) { _tzname = tzname; } bool DateTime::operator>(const DateTime& dt) const throw() { return (Date::operator>(dt) || (Date::operator==(dt) && Time::operator>(dt))); } bool DateTime::operator<(const DateTime& dt) const throw() { return (Date::operator<(dt) || (Date::operator==(dt) && Time::operator<(dt))); } bool DateTime::operator>=(const DateTime& dt) const throw() { return (operator>(dt) || operator==(dt)); } bool DateTime::operator<=(const DateTime& dt) const throw() { return (operator<(dt) || operator==(dt)); } bool DateTime::operator==(const DateTime& dt) const throw() { return (Date::operator==(dt) && Time::operator==(dt)); } bool DateTime::operator!=(const DateTime& dt) const throw() { return (!operator==(dt)); } std::ostream& operator << (std::ostream& os, const DateTime& dt) { os << (Date&)dt << ' ' << (Time&)dt << ' ' << dt.timeZone(); return os; } } // !namespace P |