mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 09:12:28 +02:00
- fixed GH #130: Patch: prefer sysconf over sysctlbyname - fixed GH #131: Patch: no timezone global var on OpenBSD
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user