#3274: Fix localtime_r for VxWorks 6.9 and later

This commit is contained in:
Günter Obiltschnig 2021-06-15 15:14:11 +02:00
parent d4ec18d503
commit 19b2c5b415
2 changed files with 16 additions and 12 deletions

View File

@ -270,7 +270,7 @@ void LocalDateTime::determineTzd(bool adjust)
_tzd = (Timezone::utcOffset() + ((broken->tm_isdst == 1) ? 3600 : 0));
#else
std::tm broken;
#if defined(POCO_VXWORKS)
#if defined(POCO_VXWORKS) && (defined(_VXWORKS_COMPATIBILITY_MODE) || (defined(_WRS_VXWORKS_MAJOR) && ((_WRS_VXWORKS_MAJOR < 6) || ((_WRS_VXWORKS_MAJOR == 6) && (_WRS_VXWORKS_MINOR < 9)))))
if (localtime_r(&epochTime, &broken) != OK)
throw Poco::SystemException("cannot get local time");
#else

View File

@ -35,7 +35,11 @@ int Timezone::dst()
{
std::time_t now = std::time(NULL);
struct std::tm t;
#if defined(_VXWORKS_COMPATIBILITY_MODE) || (defined(_WRS_VXWORKS_MAJOR) && ((_WRS_VXWORKS_MAJOR < 6) || ((_WRS_VXWORKS_MAJOR == 6) && (_WRS_VXWORKS_MINOR < 9))))
if (localtime_r(&now, &t) != OK)
#else
if (!localtime_r(&now, &t))
#endif
throw Poco::SystemException("cannot get local time DST offset");
return t.tm_isdst == 1 ? 3600 : 0;
}