libcryptosec
|
Implementa a representação da data. É utilizada em certificados, LCRs. Utiliza o formato epoch (time_t) para representar datas internamente. More...
#include <DateTime.h>
Classes | |
struct | DateVal |
Public Member Functions | |
DateTime () throw (BigIntegerException) | |
DateTime (time_t dateTime) throw (BigIntegerException) | |
DateTime (BigInteger const &dateTime) throw (BigIntegerException) | |
DateTime (ASN1_TIME *asn1Time) throw (BigIntegerException) | |
DateTime (std::string utc) throw (BigIntegerException) | |
virtual | ~DateTime () |
std::string | getXmlEncoded (std::string tab="") const throw (BigIntegerException) |
void | setDateTime (time_t dateTime) throw (BigIntegerException) |
void | setDateTime (BigInteger const &dateTime) throw (BigIntegerException) |
time_t | getDateTime () const throw (BigIntegerException) |
BigInteger const & | getSeconds () const throw () |
ASN1_TIME * | getAsn1Time () const throw (BigIntegerException) |
ASN1_TIME * | getGeneralizedTime () const throw (BigIntegerException) |
ASN1_TIME * | getUTCTime () const throw (BigIntegerException) |
std::string | getISODate () const throw (BigIntegerException) |
DateTime & | operator= (const DateTime &value) throw (BigIntegerException) |
void | addSeconds (long b) throw (BigIntegerException) |
void | addMinutes (long b) throw (BigIntegerException) |
void | addHours (long b) throw (BigIntegerException) |
void | addDays (long b) throw (BigIntegerException) |
void | addYears (long b) throw (BigIntegerException) |
bool | operator== (const DateTime &other) const throw () |
bool | operator== (time_t other) const throw (BigIntegerException) |
bool | operator< (const DateTime &other) const throw () |
bool | operator< (time_t other) const throw (BigIntegerException) |
bool | operator> (const DateTime &other) const throw () |
bool | operator> (time_t other) const throw (BigIntegerException) |
Static Public Member Functions | |
static DateTime::DateVal | getDate (BigInteger const &epoch) throw (BigIntegerException) |
static BigInteger | date2epoch (string aString) throw (BigIntegerException) |
static BigInteger | date2epoch (int year, int month, int day, int hour, int min, int sec) throw (BigIntegerException) |
static int | getDayOfWeek (int year, int month, int day) throw () |
static bool | isLeapYear (int y) throw () |
static int | getYearSize (int year) |
static int | getMonthSize (int month, int year) |
Protected Attributes | |
BigInteger | seconds |
Implementa a representação da data. É utilizada em certificados, LCRs. Utiliza o formato epoch (time_t) para representar datas internamente.
DateTime::DateTime | ( | ) | ||
throw | ( | BigIntegerException | ||
) |
Construtor padrão. Cria um objeto DateTime com data 0 (00:00:00 UTC, 1 de Janeiro de 1970).
DateTime::DateTime | ( | time_t | dateTime | ) | |
throw | ( | BigIntegerException | |||
) |
Construtor. Cria um objeto DateTime com uma data específica.
dateTime | data específica em segundos. obs: linux: time_t = __SLONGWORD_TYPE = long int = long. |
DateTime::DateTime | ( | BigInteger const & | dateTime | ) | |
throw | ( | BigIntegerException | |||
) |
Construtor. Cria um objeto DateTime com uma data específica.
dateTime | data específica em segundos. |
DateTime::DateTime | ( | ASN1_TIME * | asn1Time | ) | |
throw | ( | BigIntegerException | |||
) |
Contrutor. Cria um objeto DateTime com uma data específica.
asn1Time | data específica. |
DateTime::DateTime | ( | std::string | utc | ) | |
throw | ( | BigIntegerException | |||
) |
Contrutor. Cria um objeto DateTime com uma data específica.
utc | string no formato UTCTime(YYMMDDHHMMSSZ) ou GeneralizedTime (YYYYMMDDHHMMSSZ). Notar que ambos estão no fuso Zulu (GMT+0). |
|
virtual |
Destrutor.
void DateTime::addDays | ( | long | b | ) | |
throw | ( | BigIntegerException | |||
) |
Adiciona dias.
quantidade | de dias. |
void DateTime::addHours | ( | long | b | ) | |
throw | ( | BigIntegerException | |||
) |
Adiciona horas.
quantidade | de horas. |
void DateTime::addMinutes | ( | long | b | ) | |
throw | ( | BigIntegerException | |||
) |
Adiciona minutos.
quantidade | de minutos. |
void DateTime::addSeconds | ( | long | b | ) | |
throw | ( | BigIntegerException | |||
) |
Adiciona segundos.
quantidade | de segundos. |
void DateTime::addYears | ( | long | b | ) | |
throw | ( | BigIntegerException | |||
) |
Adiciona anos.
quantidade | de anos. |
|
inlinestatic |
Transforma de formato UTCTime(YYMMDDHHMMSSZ) ou GeneralizedTime (YYYYMMDDHHMMSSZ) para epoch(segundos).
aString | string no formato 'YYMMDDHHMMSSZ' ou 'YYYYMMDDHHMMSSZ'. return segundos. |
|
inlinestatic |
Transforma do formato ano, mês [0-11], dia [1-31], hora [0-23], minuto [0-59] e segundo 0-59 para epoch.
ASN1_TIME * DateTime::getAsn1Time | ( | ) | const | |
throw | ( | BigIntegerException | ||
) |
Obtem data em formato ASN1.
|
inlinestatic |
Transforma do formato em segundos (epoch) para ano, mês, dia, hora, minuto e segundo.
epoch | referência para segundos. |
time_t DateTime::getDateTime | ( | ) | const | |
throw | ( | BigIntegerException | ||
) |
Obtem data em segundos.
|
inlinestatic |
ASN1_TIME * DateTime::getGeneralizedTime | ( | ) | const | |
throw | ( | BigIntegerException | ||
) |
Obtem data em formato ASN1.
std::string DateTime::getISODate | ( | ) | const | |
throw | ( | BigIntegerException | ||
) |
Obtem data em formato ISO8601.
|
inlinestatic |
Retorna quantidade de dias de um ano
month | mês [0-11] |
year | ano desejado. |
BigInteger const & DateTime::getSeconds | ( | ) | const | |
throw | ( | |||
) |
Obtem data em segundos.
ASN1_TIME * DateTime::getUTCTime | ( | ) | const | |
throw | ( | BigIntegerException | ||
) |
Obtem data em formato ASN1.
std::string DateTime::getXmlEncoded | ( | std::string | tab = "" | ) | const |
throw | ( | BigIntegerException | |||
) |
Obtem representação da data em formato Xml
|
inlinestatic |
Retorna quantidade de dias de um ano
year | ano desejado. |
|
inlinestatic |
Retorna dia da semana de referência (doomsday) para um ano específico.
year | ano. |
y | ano. |
bool DateTime::operator< | ( | const DateTime & | other | ) | const |
throw | ( | ||||
) |
bool DateTime::operator< | ( | time_t | other | ) | const |
throw | ( | BigIntegerException | |||
) |
DateTime & DateTime::operator= | ( | const DateTime & | value | ) | |
throw | ( | BigIntegerException | |||
) |
Operador de atribuição.
value | referência para objeto DateTime. |
bool DateTime::operator== | ( | const DateTime & | other | ) | const |
throw | ( | ||||
) |
bool DateTime::operator== | ( | time_t | other | ) | const |
throw | ( | BigIntegerException | |||
) |
bool DateTime::operator> | ( | const DateTime & | other | ) | const |
throw | ( | ||||
) |
bool DateTime::operator> | ( | time_t | other | ) | const |
throw | ( | BigIntegerException | |||
) |
void DateTime::setDateTime | ( | time_t | dateTime | ) | |
throw | ( | BigIntegerException | |||
) |
Define a data do objeto DateTime.
dateTime | data específica em segundos. |
void DateTime::setDateTime | ( | BigInteger const & | dateTime | ) | |
throw | ( | BigIntegerException | |||
) |
Define a data do objeto DateTime.
dateTime | data específica em segundos. |
|
protected |