- fixed GH #130: Patch: prefer sysconf over sysctlbyname
- fixed GH #131: Patch: no timezone global var on OpenBSD
This commit is contained in:
aleks-f 2013-03-19 21:15:21 -05:00
parent ab952e689d
commit 2c5601ea69
3 changed files with 8 additions and 6 deletions

View File

@ -31,6 +31,8 @@ Release 1.5.2 (2013-03-??)
- SocketAddress small object optimization
- fixed GH #79: Poco::Thread leak on Linux
- fixed GH #61: static_md build configs for Crypto and NetSSL
- fixed GH #130: prefer sysconf over sysctlbyname
- fixed GH #131: no timezone global var on OpenBSD
Release 1.5.1 (2013-01-11)
==========================

View File

@ -133,7 +133,11 @@ std::string EnvironmentImpl::nodeNameImpl()
unsigned EnvironmentImpl::processorCountImpl()
{
#if defined(POCO_OS_FAMILY_BSD)
#if defined(_SC_NPROCESSORS_ONLN)
int count = sysconf(_SC_NPROCESSORS_ONLN);
if (count <= 0) count = 1;
return static_cast<int>(count);
#elif defined(POCO_OS_FAMILY_BSD)
unsigned count;
std::size_t size = sizeof(count);
if (sysctlbyname("hw.ncpu", &count, &size, 0, 0))
@ -142,10 +146,6 @@ unsigned EnvironmentImpl::processorCountImpl()
return count;
#elif POCO_OS == POCO_OS_HPUX
return pthread_num_processors_np();
#elif defined(_SC_NPROCESSORS_ONLN)
int count = sysconf(_SC_NPROCESSORS_ONLN);
if (count <= 0) count = 1;
return static_cast<int>(count);
#else
return 1;
#endif

View File

@ -52,7 +52,7 @@ public:
int timeZone()
{
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(POCO_ANDROID) // no timezone global var
#if defined(__APPLE__) || defined(__FreeBSD__) || defined (__OpenBSD__) || defined(POCO_ANDROID) // no timezone global var
std::time_t now = std::time(NULL);
struct std::tm t;
gmtime_r(&now, &t);