Broaden condition on use of MS's localtime_s()

It's available on MinGW, so not limited to MSVC; and the MinGW
localtime() and localtime_r() fail in some cases where it works.

Use the generic name rather than _localtime64_s(), since localtime_s()
now just calls it; and, in any case, we were assuming time_t is
__time64_t when calling it.

Change-Id: I316cc5b1a3e19cd6725555042dfaba3124a25a03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2021-10-08 13:15:48 +02:00
parent a4e9ea7a1f
commit 299f016b5d

View File

@ -2619,8 +2619,8 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT
Q_ASSERT(res == &local);
valid = true;
}
#elif defined(Q_CC_MSVC)
if (!_localtime64_s(&local, &secsSinceEpoch))
#elif defined(Q_OS_WIN)
if (!localtime_s(&local, &secsSinceEpoch))
valid = true;
#else
// Returns shared static data which may be overwritten at any time