38 #define gettimeofday __hide_gettimeofday 43 #if defined(_OS_WIN32_) 44 #if defined(_CC_BOOL_DEF_) 51 #elif defined(_OS_MSDOS_) 53 #elif defined(_OS_OS2_) 55 #elif defined(_OS_UNIX_) || defined(_OS_MAC_) 59 extern "C" int gettimeofday(
struct timeval *,
struct timezone * );
71 static const short monthDays[] ={0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
76 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
77 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec" };
80 "Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
"Sun" };
230 return (((
jd+1) % 7) + 6)%7 + 1;
284 #if defined(CHECK_RANGE) 285 if ( month < 1 || month > 12 ) {
286 qWarning(
"QDate::monthName: Parameter out ouf range." );
304 #if defined(CHECK_RANGE) 305 if ( weekday < 1 || weekday > 7 ) {
306 qWarning(
"QDate::dayName: Parameter out of range." );
351 #if defined(CHECK_RANGE) 352 qWarning(
"QDate::setYMD: Invalid date %04d/%02d/%02d", y, m, d );
439 #if defined(_OS_WIN32_) 451 tm *t = localtime( <ime );
453 d.
jd =
greg2jul( t->tm_year + 1900, t->tm_mon + 1, t->tm_mday );
479 if ( y >= 0 && y <= 99 )
482 (m == 9 && d < 14))) )
484 return (d > 0 && m > 0 && m <= 12) &&
494 return (y % 4 == 0 && y % 100 != 0) || (y % 400 == 0);
518 return 1721119 + d + (146097*
c)/4 + (1461*ya)/4 + (153*m+2)/5;
531 uint j = jd - 1721119;
532 y = (j*4 - 1)/146097;
533 j = j*4 - 146097*y - 1;
535 j = (x*4 + 3) / 1461;
537 x = (x*4) + 3 - 1461*j;
620 setHMS( h, m, s, ms );
709 #if defined(CHECK_RANGE) 710 qWarning(
"QTime::setHMS Invalid time %02d:%02d:%02d.%03d", h, m, s,
741 return addMSecs(nsecs*1000);
756 return ((
int)t.
ds - (
int)
ds)/1000;
866 #if defined(CHECK_NULL) 867 qWarning(
"QTime::currentTime(QTime *): Null pointer not allowed" );
872 #if defined(_OS_WIN32_) 877 1000*t.wSecond + t.wMilliseconds;
878 return (t.wHour == 0 && t.wMinute == 0);
880 #elif defined(_OS_OS2_) 883 DosGetDateTime( &t );
885 1000*t.seconds + 10*t.hundredths;
886 return (t.hours == 0 && t.minutes == 0);
888 #elif defined(_OS_MSDOS_) 893 t.second*1000 + t.hsecond*10;
894 return (t.hour== 0 && t.minute == 0);
896 #elif defined(_OS_UNIX_) || defined(_OS_MAC_) 900 time_t ltime = tv.tv_sec;
901 tm *t = localtime( <ime );
903 1000*t->tm_sec + tv.tv_usec/1000 );
904 return (t->tm_hour== 0 && t->tm_min == 0);
910 tm *t = localtime( <ime );
913 return (t->tm_hour== 0 && t->tm_min == 0);
951 *
this = currentTime();
976 int n = msecsTo( t );
1002 int n = msecsTo( currentTime() );
1144 time_t
tmp = (time_t) secsSince1Jan1970UTC;
1145 tm *tM = localtime( &tmp );
1147 tM = gmtime( &tmp );
1218 tt += sign*nsecs*1000;
1274 return t == dt.
t &&
d == dt.
d;
1285 return t != dt.
t ||
d != dt.
d;
1355 #ifndef QT_NO_DATASTREAM 1419 return s << dt.
d << dt.
t;
1434 #endif //QT_NO_DATASTREAM
static const uint MSECS_PER_HOUR
virtual QString monthName(int month) const
QString & sprintf(const char *format,...)
static const uint SECS_PER_MIN
static const char *const monthNames[]
bool operator>=(const QDateTime &dt) const
static void jul2greg(uint jd, int &y, int &m, int &d)
int daysTo(const QDate &) const
The QDate class provides date functions.
QDateTime addDays(int days) const
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
void qWarning(const char *msg,...)
static const short monthDays[]
static const uint SECS_PER_DAY
static uint greg2jul(int y, int m, int d)
static QString fromLatin1(const char *, int len=-1)
static constexpr double ms
QDate addDays(int days) const
The QTime class provides clock time functions.
int msecsTo(const QTime &) const
void setTime_t(uint secsSince1Jan1970UTC)
QTime addMSecs(int ms) const
QString & setNum(short, int base=10)
static QDate currentDate()
virtual QString dayName(int weekday) const
int daysTo(const QDateTime &) const
int secsTo(const QDateTime &) const
bool operator!=(const QDateTime &dt) const
static const int FIRST_YEAR
static const uint SECS_PER_HOUR
bool operator>(const QDateTime &dt) const
bool operator==(const QDateTime &dt) const
static const char *const weekdayNames[]
bool operator<=(const QDateTime &dt) const
static const uint FIRST_DAY
The QDateTime class provides date and time functions.
static QTime currentTime()
static bool leapYear(int year)
friend Q_EXPORT QDataStream & operator>>(QDataStream &, QDateTime &)
static const uint MSECS_PER_MIN
static QDateTime currentDateTime()
bool setYMD(int y, int m, int d)
int secsTo(const QTime &) const
friend Q_EXPORT QDataStream & operator<<(QDataStream &, const QDateTime &)
The QDataStream class provides serialization of binary data to a QIODevice.
QTime addSecs(int secs) const
QDateTime addSecs(int secs) const
static const uint MSECS_PER_DAY
second_as<> second
Type of time stored in seconds, in double precision.
bool operator<(const QDateTime &dt) const
bool setHMS(int h, int m, int s, int ms=0)