trunk/branch integration: LocalDateTime

This commit is contained in:
Marian Krivos 2011-08-22 18:18:14 +00:00
parent 072d98fee4
commit cbb5bec729

View File

@ -79,7 +79,7 @@ public:
/// for the current time zone. /// for the current time zone.
LocalDateTime(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0); LocalDateTime(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0);
/// Creates a DateTime for the given Gregorian local date and time. /// Creates a LocalDateTime for the given Gregorian local date and time.
/// * year is from 0 to 9999. /// * year is from 0 to 9999.
/// * month is from 1 to 12. /// * month is from 1 to 12.
/// * day is from 1 to 31. /// * day is from 1 to 31.
@ -91,7 +91,7 @@ public:
//@ deprecated //@ deprecated
LocalDateTime(int tzd, int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond); LocalDateTime(int tzd, int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond);
/// Creates a DateTime for the given Gregorian date and time in the /// Creates a LocalDateTime for the given Gregorian date and time in the
/// time zone denoted by the time zone differential in tzd. /// time zone denoted by the time zone differential in tzd.
/// * tzd is in seconds. /// * tzd is in seconds.
/// * year is from 0 to 9999. /// * year is from 0 to 9999.
@ -268,6 +268,9 @@ protected:
void adjustForTzd(); void adjustForTzd();
/// Adjust the _dateTime member based on the _tzd member. /// Adjust the _dateTime member based on the _tzd member.
std::time_t dstOffset(int& dstOffset) const;
/// Determine the DST offset for the current date/time.
private: private:
DateTime _dateTime; DateTime _dateTime;
@ -376,11 +379,13 @@ inline int LocalDateTime::tzd() const
return _tzd; return _tzd;
} }
inline Timestamp LocalDateTime::timestamp() const inline Timestamp LocalDateTime::timestamp() const
{ {
return Timestamp::fromUtcTime(_dateTime.utcTime()); return Timestamp::fromUtcTime(_dateTime.utcTime());
} }
inline Timestamp::UtcTimeVal LocalDateTime::utcTime() const inline Timestamp::UtcTimeVal LocalDateTime::utcTime() const
{ {
return _dateTime.utcTime() - ((Timestamp::TimeDiff) _tzd)*10000000; return _dateTime.utcTime() - ((Timestamp::TimeDiff) _tzd)*10000000;