mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Add hack to fix MacOS X build
This commit is contained in:
parent
049f1abb62
commit
4e3a599f68
20
src/utils.cc
20
src/utils.cc
@ -321,13 +321,19 @@ void createDir(std::string dir, int mode) {
|
|||||||
|
|
||||||
|
|
||||||
double cpu_seconds(void) {
|
double cpu_seconds(void) {
|
||||||
struct timespec t;
|
/*
|
||||||
if (!clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &t))
|
* FIXME: Temporary hack to fix build on MacOS X. Very issuficient way, but
|
||||||
return static_cast<double>(t.tv_sec)
|
* works. Worth reimplementing using mach_absolute_time().
|
||||||
+ static_cast<double>(t.tv_nsec / 1000000000.0);
|
*/
|
||||||
else
|
#ifndef MACOSX
|
||||||
return static_cast<double>(clock()) /
|
struct timespec t;
|
||||||
static_cast<double>(CLOCKS_PER_SEC);
|
if (!clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &t))
|
||||||
|
return static_cast<double>(t.tv_sec)
|
||||||
|
+ static_cast<double>(t.tv_nsec / 1000000000.0);
|
||||||
|
else
|
||||||
|
return static_cast<double>(clock()) /
|
||||||
|
static_cast<double>(CLOCKS_PER_SEC);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user