katie_check_function(get_current_dir_name "unistd.h")
katie_check_function(prctl "sys/prctl.h")
katie_check_function(pthread_setname_np "pthread.h" "${CMAKE_THREAD_LIBS_INIT}")
+katie_check_function(timegm "time.h")
+katie_check_struct(tm tm_gmtoff "time.h")
+katie_check_struct(tm tm_zone "time.h")
# ISO/IEC 9899:1999
katie_check_function(fegetenv "fenv.h")
katie_check_function(fesetenv "fenv.h")
// FIXME: Since we sort by string value, a fast algorithm might be to use a radix sort. That would be O(N) rather
// than O(N log N).
-#if HAVE(MERGESORT)
- mergesort(values.begin(), values.size(), sizeof(ValueStringPair), compareByStringPairForQSort);
-#else
// FIXME: The qsort library function is likely to not be a stable sort.
// ECMAScript-262 does not specify a stable sort, but in practice, browsers perform a stable sort.
qsort(values.begin(), values.size(), sizeof(ValueStringPair), compareByStringPairForQSort);
-#endif
// FIXME: If the toString function changed the length of the array, this might be
// modifying the vector incorrectly.
return year;
}
-#if !HAVE(TM_GMTOFF)
-
+#if !defined(QT_HAVE_TM_TM_GMTOFF)
static int32_t calculateUTCOffset()
{
time_t localTime = ::time(0);
- tm localt;
+ struct tm localt;
getLocalTime(&localTime, &localt);
// Get the difference between this time zone and UTC on the 1st of January of this year.
localt.tm_wday = 0;
localt.tm_yday = 0;
localt.tm_isdst = 0;
-#if HAVE(TM_GMTOFF)
+#if defined(QT_HAVE_TM_TM_GMTOFF)
localt.tm_gmtoff = 0;
#endif
-#if HAVE(TM_ZONE)
+#if defined(QT_HAVE_TM_TM_ZONE)
localt.tm_zone = 0;
#endif
-#if HAVE(TIMEGM)
+#if defined(QT_HAVE_TIMEGM)
time_t utcOffset = ::timegm(&localt) - ::mktime(&localt);
#else
// Using a canned date of 01/01/2009 on platforms with weaker date-handling foo.
int offsetHour = msToHours(offsetTime);
int offsetMinute = msToMinutes(offsetTime);
- tm localTM;
+ struct tm localTM;
getLocalTime(&localTime, &localTM);
double diff = ((localTM.tm_hour - offsetHour) * secondsPerHour) + ((localTM.tm_min - offsetMinute) * 60);
return (diff * msPerSecond);
}
-
-#endif
+#endif // !QT_HAVE_TM_TM_GMTOFF
// Returns combined offset in millisecond (UTC + DST).
LocalTimeOffset calculateLocalTimeOffset(double ms)
// FIXME: time_t has a potential problem in 2038.
time_t localTime = static_cast<time_t>(localTimeSeconds);
-#if HAVE(TM_GMTOFF)
- tm localTM;
+#if defined(QT_HAVE_TM_TM_GMTOFF)
+ struct tm localTM;
getLocalTime(&localTime, &localTM);
return LocalTimeOffset(localTM.tm_isdst, localTM.tm_gmtoff * msPerSecond);
#else
operator tm() const
{
- tm ret;
- memset(&ret, 0, sizeof(ret));
+ struct tm ret;
+ ::memset(&ret, 0, sizeof(ret));
ret.tm_sec = second;
ret.tm_min = minute;
ret.tm_year = year;
ret.tm_isdst = isDST;
-#if HAVE(TM_GMTOFF)
+#if defined(QT_HAVE_TM_TM_GMTOFF)
ret.tm_gmtoff = static_cast<long>(utcOffset);
#endif
-#if HAVE(TM_ZONE)
+#if defined(QT_HAVE_TM_TM_ZONE)
ret.tm_zone = timeZone;
#endif
QT_USE_NAMESPACE
-/* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
-
-/* HAVE() - specific system features (headers, functions or similar) that are present or not */
-#define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE)
-
/* ==== Policy decision macros: these define policy choices for a particular port. ==== */
/* USE() - use a particular third-party library or optional OS service */
/* ENABLE() - turn on a specific feature of WebKit */
#define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE)
-/* Operating environments */
-
-#if !defined(Q_OS_SOLARIS)
-#define HAVE_TM_GMTOFF 1
-#define HAVE_TM_ZONE 1
-#define HAVE_TIMEGM 1
-#endif
-
/* ENABLE macro defaults */
#define ENABLE_OPCODE_STATS 0