| TerraLib 4.1

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
TeTime Class Reference

A class for supporting date and time. More...

`#include <TeTime.h>`

List of all members.

## Public Member Functions

time_t | now (void)
| Set the date and time from the system clock.
| TeTime (void)
| Set all time information with NULL value.
| TeTime (const TeTime &t)
| Copy constructor.
| TeTime (int h, int m, int s, TeChronon chronon)
| Set the date from the system clock and the time from its parameter list. Chronon defaulted to second.
| TeTime (const std::string &dt, TeChronon chronon, const std::string &mask, const std::string &dateS="/", const std::string &timeS=":", const std::string &indPM="PM")
| Set date and time from arguments, though the time fields.
std::string | getTime () const
| Return a time of day std::string in format "hh:mm:ss".
std::string | getDate (void) const
| Return a std::string to the date in the form "yyyy-mm-dd".
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
| Return a pointer to the date and time in the form passed in mask.
time_t | Set (int y, int m, int d, int h=0, int min=0, int s=0)
| Reset time to the specified arguments. Return time_t: number of seconds since 0:00:00 Jan 1 1987.
const time_t & | Get () const
| Return the current time (time_t format: number of seconds since 0:00:00 Jan 1 1987).
int | year () const
| Get year value as an four digit integer.
int | month () const
| Get month value.
int | day () const
| Get day of the month value.
int | hour () const
| Get hour value as an integer.
int | minute () const
| Get minute value as an integer.
int | second () const
| Get second value as an integer.
int | weekDay () const
| Get week day as in integer.
int | yearDay () const
| Get year day as in integer.
TeChronon | chronon () const
| Get chronon definition.
void | chronon (TeChronon c)
| Set chronon definition.
TeTime & | operator= (const TeTime &)
| Assignment operator for TeTime objects.
TeTime & | operator+= (int delta)
| Add 'delta' chronon units to the current date. Return current date.
TeTime & | operator++ ()
| Increase a chronon unit in the time (Prefix operator)
TeTime | operator+ (int delta)
| Add 'delta' chronon units to the current date and return a new date. Return new date.
TeTime & | operator-= (int delta)
| Subtract 'delta' chronon units from the current date. Return current date.
bool | operator== (const TeTime &time) const
| Operator ==.
bool | operator< (const TeTime &time) const
| Operator <.
bool | operator<= (const TeTime &time) const
| Operator <=.
int | operator- (const TeTime &other)
| Returns the difference betwwen the times in seconds.
bool | isValid () const
| Verify if the time has null values.
| ~TeTime (void)
| Normal destructor.

## Detailed Description

A class for supporting date and time.

Examples:

  createTable.cpp.

## Constructor & Destructor Documentation

TeTime::TeTime | ( | void |  | ) |

Set all time information with NULL value.

TeTime::TeTime | ( | const TeTime & | t | ) |

Copy constructor.

TeTime::TeTime | ( | int | h,
|  | int | m,
|  | int | s,
|  | TeChronon | chronon
| ) |  |

Set the date from the system clock and the time from its parameter list. Chronon defaulted to second.

TeTime::TeTime | ( | const std::string & | dt,
|  | TeChronon | chronon,
|  | const std::string & | mask,
|  | const std::string & | dateS = `"/"`,
|  | const std::string & | timeS = `":"`,
|  | const std::string & | indPM = `"PM"`
| ) |  |

Set date and time from arguments, though the time fields.

TeTime::~TeTime | ( | void |  | ) | `[inline]`

Normal destructor.

## Member Function Documentation

TeChronon TeTime::chronon | ( |  | ) | const`[inline]`

Get chronon definition.

void TeTime::chronon | ( | TeChronon | c | ) |

Set chronon definition.

int TeTime::day | ( |  | ) | const`[inline]`

Get day of the month value.

const time_t& TeTime::Get | ( |  | ) | const`[inline]`

Return the current time (time_t format: number of seconds since 0:00:00 Jan 1 1987).

Returns:
  The current time (time_t format: number of seconds since 0:00:00 Jan 1 1987).

std::string TeTime::getDate | ( | void |  | ) | const

Return a std::string to the date in the form "yyyy-mm-dd".

std::string TeTime::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

Return a pointer to the date and time in the form passed in mask.

Examples:
  createTable.cpp.

std::string TeTime::getTime | ( |  | ) | const

Return a time of day std::string in format "hh:mm:ss".

int TeTime::hour | ( |  | ) | const`[inline]`

Get hour value as an integer.

bool TeTime::isValid | ( |  | ) | const

Verify if the time has null values.

int TeTime::minute | ( |  | ) | const`[inline]`

Get minute value as an integer.

int TeTime::month | ( |  | ) | const`[inline]`

Get month value.

time_t TeTime::now | ( | void |  | ) |

Set the date and time from the system clock.

TeTime TeTime::operator+ | ( | int | delta | ) |

Add 'delta' chronon units to the current date and return a new date. Return new date.

TeTime & TeTime::operator++ | ( |  | ) |

Increase a chronon unit in the time (Prefix operator)

TeTime & TeTime::operator+= | ( | int | delta | ) |

Add 'delta' chronon units to the current date. Return current date.

int TeTime::operator- | ( | const TeTime & | other | ) |

Returns the difference betwwen the times in seconds.

TeTime & TeTime::operator-= | ( | int | delta | ) |

Subtract 'delta' chronon units from the current date. Return current date.

bool TeTime::operator< | ( | const TeTime & | time | ) | const

Operator <.

bool TeTime::operator<= | ( | const TeTime & | time | ) | const

Operator <=.

TeTime & TeTime::operator= | ( | const TeTime & | other | ) |

Assignment operator for TeTime objects.

bool TeTime::operator== | ( | const TeTime & | time | ) | const

Operator ==.

int TeTime::second | ( |  | ) | const`[inline]`

Get second value as an integer.

time_t TeTime::Set | ( | int | y,
|  | int | m,
|  | int | d,
|  | int | h = `0`,
|  | int | min = `0`,
|  | int | s = `0`
| ) |  |

Reset time to the specified arguments. Return time_t: number of seconds since 0:00:00 Jan 1 1987.

Parameters:

  y | year
  m | month
  d | day
  h | hour
  min | minutes
  s | seconds

int TeTime::weekDay | ( |  | ) | const`[inline]`

Get week day as in integer.

int TeTime::year | ( |  | ) | const`[inline]`

Get year value as an four digit integer.

int TeTime::yearDay | ( |  | ) | const`[inline]`

Get year day as in integer.

The documentation for this class was generated from the following files:

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeTime.h
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeTime.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines