All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TimeInstantTZ.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/datatype/TimeInstantTZ.cpp
22 
23  \brief A class to represent time instant with time zone.
24 */
25 
26 // TerraLib
27 #include "TimeInstantTZ.h"
28 
30 {
31  const te::dt::TimeInstantTZ* t = dynamic_cast<const te::dt::TimeInstantTZ*>(&rhs);
32  return m_timeInstantTZ == t->m_timeInstantTZ;
33 }
34 
36 {
37  const te::dt::TimeInstantTZ* t = dynamic_cast<const te::dt::TimeInstantTZ*>(&rhs);
38  return m_timeInstantTZ != t->m_timeInstantTZ;
39 }
40 
42 {
43  const te::dt::TimeInstantTZ* t = dynamic_cast<const te::dt::TimeInstantTZ*>(&rhs);
44  return m_timeInstantTZ < t->m_timeInstantTZ;
45 }
46 
48 {
49  const te::dt::TimeInstantTZ* t = dynamic_cast<const te::dt::TimeInstantTZ*>(&rhs);
50  return m_timeInstantTZ > t->m_timeInstantTZ;
51 }
52 
54 {
55  boost::posix_time::time_duration td(m_timeInstantTZ - rhs.m_timeInstantTZ);
56  return td.total_seconds();
57 }
58 
60 {
61  return new TimeInstantTZ(*this);
62 }
63 
65 {
66  std::string t(boost::posix_time::to_simple_string(m_timeInstantTZ.utc_time()));
67  //std::string t(boost::posix_time::to_iso_extended_string(m_timeInstantTZ.utc_time()));
68  //std::string t(boost::posix_time::to_iso_string(m_timeInstantTZ.utc_time()));
69  t += m_timeInstantTZ.zone()->to_posix_string();
70 
71  return t;
72 }
73 
75 {
76 }
bool operator==(const DateTime &rhs) const
Operator ==.
bool operator<(const DateTime &rhs) const
Operator <.
bool operator>(const DateTime &rhs) const
Operator >
virtual ~TimeInstantTZ()
Constructor.
AbstractData * clone() const
It returns a clone of this object.
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
A class to represent time instant with time zone.
long operator-(const TimeInstantTZ &rhs) const
Operator -.
boost::local_time::local_date_time m_timeInstantTZ
Time instant with time zone information.
bool operator!=(const DateTime &rhs) const
Operator !=.
A class to represent time instant with time zone.
Definition: TimeInstantTZ.h:52
std::string toString() const
It returns the time instant with time zone in the ISO textual format (YYYYMMDDThhmmss±hhmm).