<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">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) &amp;&amp; defined(CLOCK_MONOTONIC)
 int Timer::now(struct timeval *time) {
+#if defined(SW_USE_MONOTONIC_TIME) &amp;&amp; defined(CLOCK_MONOTONIC)
     struct timespec _now;
     if (clock_gettime(CLOCK_MONOTONIC, &amp;_now) &lt; 0) {
         swoole_sys_warning("clock_gettime(CLOCK_MONOTONIC) failed");
@@ -253,12 +253,12 @@
     time-&gt;tv_sec = _now.tv_sec;
     time-&gt;tv_usec = _now.tv_nsec / 1000;
 #else
-if (gettimeofday(time, nullptr) &lt; 0) {
-    swoole_sys_warning("gettimeofday() failed");
-    return SW_ERR;
-}
+    if (gettimeofday(time, nullptr) &lt; 0) {
+        swoole_sys_warning("gettimeofday() failed");
+        return SW_ERR;
+    }
 #endif
     return SW_OK;
-}  // namespace swoole
+}

 };  // namespace swoole
</pre></body></html>