| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeTime.h
Go to the documentation of this file.

    00001 /************************************************************************************
    00002 TerraLib - a library for developing GIS applications.
    00003 Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio.
    00004
    00005 This code is part of the TerraLib library.
    00006 This library is free software; you can redistribute it and/or
    00007 modify it under the terms of the GNU Lesser General Public
    00008 License as published by the Free Software Foundation; either
    00009 version 2.1 of the License, or (at your option) any later version.
    00010
    00011 You should have received a copy of the GNU Lesser General Public
    00012 License along with this library.
    00013
    00014 The authors reassure the license terms regarding the warranties.
    00015 They specifically disclaim any warranties, including, but not limited to,
    00016 the implied warranties of merchantability and fitness for a particular purpose.
    00017 The library provided hereunder is on an "as is" basis, and the authors have no
    00018 obligation to provide maintenance, support, updates, enhancements, or modifications.
    00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
    00020 indirect, special, incidental, or consequential damages arising out of the use
    00021 of this library and its documentation.
    00022 *************************************************************************************/
    00026 #ifndef  __TERRALIB_INTERNAL_TIME_H
    00027 #define  __TERRALIB_INTERNAL_TIME_H
    00028
    00029 #include "TeDefines.h"
    00030 #include "TeDataTypes.h"
    00031
    00032 #include <time.h>
    00033 #include <stdio.h>
    00034 #include <string>
    00035 #include <iostream>
    00036
    00038 class TL_DLL TeTime
    00039 {
    00040     struct tm         ts_;                  // Unix time structure
    00041     time_t            last_;                // time in seconds
    00042            TeChronon  chronon_;
    00043
    00044 public:
    00045
    00047            time_t now(void);
    00048
    00050            TeTime(void);
    00051
    00053            TeTime(const TeTime& t);
    00054
    00056            TeTime(int h, int m, int s, TeChronon chronon);
    00057
    00059            TeTime(    const std::string& dt, TeChronon chronon, const std::string& mask,
    00060                                  const std::string& dateS = "/", const std::string& timeS = ":", const std::string& indPM = "PM");
    00061
    00063            std::string getTime() const;
    00064
    00066            std::string getDate(void) const;
    00067
    00069            std::string getDateTime (const std::string& mask= "DDsMMsYYYYsHHsmmsSS", const std::string& dateS="/", const std::string& timeS=":", const std::string& indPM="PM", const std::string& indAM="AM") const;
    00070
    00072
    00080            time_t Set(int y, int m, int d, int h = 0, int min = 0, int s = 0);
    00081
    00083
    00086   inline const time_t& Get() const { return last_; };
    00087
    00089            int year() const {return ts_.tm_year+1900;}
    00090
    00092            int month() const {return ts_.tm_mon+1;}
    00093
    00095            int day() const {return ts_.tm_mday;}
    00096
    00098            int hour() const {return ts_.tm_hour;}
    00099
    00101            int minute() const {return ts_.tm_min;}
    00102
    00104            int second() const {return ts_.tm_sec;}
    00105
    00107            int weekDay() const { return ts_.tm_wday;} //(0-6) 0=Sunday
    00108
    00110            int yearDay() const { return ts_.tm_yday;} //(0-365) 01/01=0
    00111
    00113            TeChronon chronon() const {return chronon_;}
    00114
    00116            void chronon (TeChronon c);
    00117
    00119            TeTime& operator=(const TeTime&);
    00120
    00122            TeTime& operator+=(int delta);
    00123
    00125            TeTime& operator++();
    00126
    00128            TeTime operator+(int delta);
    00129
    00131            TeTime& operator-=(int delta);
    00132
    00134            bool operator==(const TeTime& time) const;
    00135
    00137            bool operator<(const TeTime& time) const;
    00138
    00140            bool operator<=(const TeTime& time) const;
    00141
    00143            int operator-(const TeTime& other);
    00144
    00146            bool isValid() const;
    00147
    00149     ~TeTime(void) { }
    00150
    00151 };
    00152
    00154 TL_DLL std::ostream& operator<<(std::ostream& os, TeTime& N);
    00155
    00156
    00157 #endif
    00158
    00159

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines