4 #include <openssl/asn1.h> 59 DateTime(time_t dateTime) throw(BigIntegerException);
73 DateTime(ASN1_TIME *asn1Time) throw(BigIntegerException);
81 DateTime(
std::
string utc) throw(BigIntegerException);
98 void setDateTime(time_t dateTime) throw(BigIntegerException);
110 time_t
getDateTime() const throw(BigIntegerException);
122 ASN1_TIME*
getAsn1Time() const throw(BigIntegerException);
134 ASN1_TIME*
getUTCTime() const throw(BigIntegerException);
146 DateTime& operator =(const DateTime& value) throw(BigIntegerException);
155 const long SECS_DAY = 86400L;
172 tmp = (hours % 3600).div(60);
202 while(dayOfYear >= sizeOfMonth)
204 dayOfYear-= sizeOfMonth;
364 istringstream stream;
367 utc = aString.size() == 13;
372 stream.str(aString.substr(0,2));
386 stream.str(aString.substr(0,4));
393 stream.str(aString.substr(2 + gtoffset,2));
399 stream.str(aString.substr(4 + gtoffset,2));
404 stream.str(aString.substr(6 + gtoffset,2));
409 stream.str(aString.substr(8 + gtoffset,2));
414 stream.str(aString.substr(10 + gtoffset,2));
417 return date2epoch(year, month, day, hour, min, sec);
428 for(
int i = 1970; i <
year; i++)
433 for(
int i = 0 ; i < month ; i ++)
458 int a = (14 - month) / 12;
460 int m = month + 12 * a - 2;
461 return (day + y + (y / 4) - (y / 100) + (y / 400) + ((31 * m) / 12)) % 7;
518 return (y>0) && !(y%4) && ( (y%100) || !(y%400) );
546 int daysOfMonths[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
548 int ret = daysOfMonths[month];
void addMinutes(long b)
Definition: DateTime.cpp:351
Classe usada para representar números grandes. A limitação do tamanho do número depende da memória di...
Definition: BigInteger.h:23
BigInteger & mod(BigInteger const &a)
Definition: BigInteger.cpp:424
Implementa a representação da data. É utilizada em certificados, LCRs. Utiliza o formato epoch (time_...
Definition: DateTime.h:27
static int getMonthSize(int month, int year)
Definition: DateTime.h:544
static int getYearSize(int year)
Definition: DateTime.h:526
BigInteger & div(BigInteger const &a)
Definition: BigInteger.cpp:362
int dayOfYear
Definition: DateTime.h:44
int hour
Definition: DateTime.h:39
DateTime()
Definition: DateTime.cpp:4
int dayOfMonth
Definition: DateTime.h:40
ASN1_TIME * getUTCTime() const
Definition: DateTime.cpp:240
int dayOfWeek
Definition: DateTime.h:43
ASN1_TIME * getAsn1Time() const
Definition: DateTime.cpp:185
BigInteger & add(BigInteger const &a)
Definition: BigInteger.cpp:282
std::string getISODate() const
Definition: DateTime.cpp:289
BigInteger const & getSeconds() const
Definition: DateTime.cpp:341
int min
Definition: DateTime.h:38
bool operator==(const DateTime &other) const
Definition: DateTime.cpp:485
void addHours(long b)
Definition: DateTime.cpp:358
int mon
Definition: DateTime.h:41
time_t getDateTime() const
Definition: DateTime.cpp:134
void addSeconds(long b)
Definition: DateTime.cpp:346
double getValue() const
Definition: BigInteger.cpp:119
bool operator>(const DateTime &other) const
Definition: DateTime.cpp:505
void setDateTime(time_t dateTime)
Definition: DateTime.cpp:124
int year
Definition: DateTime.h:42
void addYears(long b)
Definition: DateTime.cpp:375
static DateTime::DateVal getDate(BigInteger const &epoch)
Definition: DateTime.h:153
BigInteger & mul(BigInteger const &a)
Definition: BigInteger.cpp:313
static int getDayOfWeek(int year, int month, int day)
Definition: DateTime.h:454
BigInteger & sub(BigInteger const &a)
Definition: BigInteger.cpp:298
Definition: BigIntegerException.h:7
BigInteger seconds
Definition: DateTime.h:572
static BigInteger date2epoch(string aString)
Definition: DateTime.h:355
void addDays(long b)
Definition: DateTime.cpp:366
std::string getXmlEncoded(std::string tab="") const
Definition: DateTime.cpp:172
static bool isLeapYear(int y)
Definition: DateTime.h:516
int sec
Definition: DateTime.h:37
static BigInteger date2epoch(int year, int month, int day, int hour, int min, int sec)
Definition: DateTime.h:424
bool operator<(const DateTime &other) const
Definition: DateTime.cpp:495
ASN1_TIME * getGeneralizedTime() const
Definition: DateTime.cpp:202
Definition: DateTime.h:35