17#if __DCL_HAVE_ALLOC_DEBUG
18#undef __DCL_ALLOC_LEVEL
19#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
22#if __DCL_HAVE_THIS_FILE__
41 assign(_year, _month, _day);
60#define AD_START 220866926
61#define BC_END (AD_START - 367)
212 return (((
__jday + 1) % 7) + 7) % 7 + 1;
220static const int __monthDays__[] =
223 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
233 return __monthDays__[
month];
246static inline int __ABS(
int _n)
248 return _n < 0 ? -_n : _n;
275 memset(&_time, 0,
sizeof(
struct tm));
276 _time.tm_year =
year - 1900;
277 _time.tm_mon =
month - 1;
284 buf->__dataLength = n;
294 int _y,
int _m,
int _d
314 return (146097 * c) / 4
323 int& _y,
int& _m,
int& _d
334 _y = (4 * _j - 1) / 146097;
335 _j = 4 * _j - 1 - 146097 * _y;
338 _j = (4 * _d + 3) / 1461;
339 _d = 4 * _d + 3 - 1461 * _j;
342 _m = (5 * _d - 3) / 153;
343 _d = 5 * _d - 3 - 153 * _m;
362 if (_m == 0 && _d == 0)
366 if ((-9999 <= _y && _y <= 9999) &&
369 if (_m == 2 && _d == 29)
372 return _d <= __monthDays__[_m];
380 return (_y % 4 == 0 && _y % 100 != 0) || _y % 400 == 0;
395#define SEC_PER_DAY 86400
396#define MSEC_PER_DAY 86400000
397#define SEC_PER_HOUR 3600
398#define MSEC_PER_HOUR 3600000
399#define SEC_PER_MIN 60
400#define MSEC_PER_MIN 60000
404 assign(_hour, _min, _sec, _millisecond);
460 result += _milliseconds;
464void Time::decode(
int& _hour,
int& _min,
int& _sec,
int& _millisecond)
const
495 return String::format(
496 L
"%02d:%02d:%02d.%03d",
514 memset(&_time, 0,
sizeof(
struct tm));
515 _time.tm_hour =
hour();
523 buf->__dataLength = n;
533 return (0 <= _hour && _hour <= 23)
534 && (0 <= _min && _min <= 59)
535 && (0 <= _sec && _sec <= 59)
536 && (0 <= _millisecond && _millisecond <= 999);
553 assign(_days, _milliseconds);
558 int _hours,
int _minutes,
int _seconds,
562 assign(_days, _hours, _minutes, _seconds, _milliseconds);
577 int _hours,
int _minutes,
int _seconds,
627 int& _hours,
int& _minutes,
int& _seconds,
690 return String::format(
691 L
"-%ld %02d:%02d:%02d.%03d",
697 return String::format(
698 L
"+%ld %02d:%02d:%02d.%03d",
726 int _hour,
int _min,
int _sec,
int _millisecond )
728 __date.assign(_year, _month, _day);
729 __time.assign(_hour, _min, _sec, _millisecond);
732static bool __tzset__ =
734static long __get_timezone__()
745 _get_timezone(&timezone);
752 long tm_gmtoff = __get_timezone__();
755 (
long) (719163 + ((_timer + tm_gmtoff) /
SEC_PER_DAY))
772 int _hour,
int _min,
int _sec,
int _millisecond )
774 __date.assign(_year, _month, _day);
775 __time.assign(_hour, _min, _sec, _millisecond);
789 + (int64_t)
__time.totalMilliSeconds()
801 + (int64_t)
__time.totalMilliSeconds()
858 int year, month, day, hour, min, sec, msec;
859 __date.decode(year, month, day);
860 __time.decode(hour, min, sec, msec);
863 time.tm_year = year - 1900;
864 time.tm_mon = month - 1;
877 buf->__dataLength = n;
903 GetSystemTime(&
time);
906 int64_t
r = dt.
days() * 24;
907 r = (
r +
time.wHour) * 60;
908 r = (
r +
time.wMinute) * 60;
909 r = (
r +
time.wSecond) * 1000;
910 r +=
time.wMilliseconds;
914 gettimeofday(&tv,
NULL);
915 int64_t
r = tv.tv_sec * 1000;
916 r += tv.tv_usec / 1000;
939 gettimeofday(&tv,
NULL);
962 (
long) (719163 + ((timeb.time - timeb.timezone * 60) /
SEC_PER_DAY))
971 long tm_gmtoff = __get_timezone__();
974 gettimeofday(&tv,
NULL);
991 const char* pszDateTimeString,
999 memset(&tm, 0,
sizeof(tm));
1000 const char* p = strptime(pszDateTimeString, _format, &tm);
1008 p - pszDateTimeString
DCLCAPI Interval operator-(const Interval &_iv1, const Interval &_iv2)
DCLCAPI Date operator+(const Date &_date, long _days)
#define DATETIME_FORMAT_BUFFER_SIZE
#define __DCL_ASSERT(expr)
const Date & operator=(const Date &_src)
const Date & operator--()
void assign(int _year, int _month, int _day)
static long convertGregorianToJulian(int _year, int _month, int _day)
static bool isValid(int y, int m, int d)
static void convertJulianToGregorian(long uJulianDays, int &_year, int &_month, int &_day)
String toStringF(const wchar_t *_format=NULL) const
static const wchar_t * FORMAT_STRING
const Date & operator++()
const Date & operator+=(long _days)
void decode(int &_year, int &_month, int &_day) const
const Date & operator-=(long _days)
static bool isLeapYear(int _year)
const DateTime & operator+=(const Interval &_iv)
void assign(time_t _timer)
const DateTime & operator=(const DateTime &_src)
static const wchar_t * FORMAT_STRING
static DateTime getCurrentUTCTime()
static int64_t getCurrentTimeMillis()
String toStringF(const wchar_t *_format=NULL) const
static DateTime getCurrentLocalTime()
static int compare(const DateTime &_dt1, const DateTime &_dt2)
const DateTime & operator-=(const Interval &_iv)
int64_t totalHours() const
int64_t totalMinutes() const
void assign(int _days, int _milliseconds)
int64_t totalSeconds() const
void decode(long &_days, int &_hours, int &_minutes, int &_seconds, int &_milliseconds) const
int64_t totalMilliSeconds() const
const Interval & operator-=(const Interval &_iv)
const Interval & operator+=(const Interval &_iv)
const Interval & operator=(const Interval &_src)
String toStringF(const wchar_t *_format=NULL)
const Time & operator=(const Time &_src)
void decode(int &_hour, int &_min, int &_sec, int &_millisecond) const
static const wchar_t * FORMAT_STRING
static bool isValid(int _hour, int _min, int _sec, int _millisecond)
const Time & operator-=(long _milliseconds)
unsigned long __milliseconds
void assign(int _hour, int _min, int _sec, int _millisecond=0)
long totalMilliSeconds() const
const Time & operator+=(long _milliseconds)