mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
33 lines
1008 B
Diff
33 lines
1008 B
Diff
Fix build failure on systems without clock_gettime.
|
|
https://github.com/swoole/swoole-src/pull/4655
|
|
--- src/core/timer.cc.orig 2022-02-24 08:50:47.000000000 -0600
|
|
+++ src/core/timer.cc 2022-03-19 18:46:11.000000000 -0500
|
|
@@ -243,8 +243,8 @@
|
|
return SW_OK;
|
|
}
|
|
|
|
-#if defined(SW_USE_MONOTONIC_TIME) && defined(CLOCK_MONOTONIC)
|
|
int Timer::now(struct timeval *time) {
|
|
+#if defined(SW_USE_MONOTONIC_TIME) && defined(CLOCK_MONOTONIC)
|
|
struct timespec _now;
|
|
if (clock_gettime(CLOCK_MONOTONIC, &_now) < 0) {
|
|
swoole_sys_warning("clock_gettime(CLOCK_MONOTONIC) failed");
|
|
@@ -253,12 +253,12 @@
|
|
time->tv_sec = _now.tv_sec;
|
|
time->tv_usec = _now.tv_nsec / 1000;
|
|
#else
|
|
-if (gettimeofday(time, nullptr) < 0) {
|
|
- swoole_sys_warning("gettimeofday() failed");
|
|
- return SW_ERR;
|
|
-}
|
|
+ if (gettimeofday(time, nullptr) < 0) {
|
|
+ swoole_sys_warning("gettimeofday() failed");
|
|
+ return SW_ERR;
|
|
+ }
|
|
#endif
|
|
return SW_OK;
|
|
-} // namespace swoole
|
|
+}
|
|
|
|
}; // namespace swoole
|