Skip to content

Commit

Permalink
Revert "apc_time: use monotonic clock if available"
Browse files Browse the repository at this point in the history
This reverts commit eb28fe1.

As reported in #451, this makes the timestamps used by apcu
inconsistent with time(), which people may have reasonably relied
on.
  • Loading branch information
nikic committed Oct 6, 2022
1 parent 5015af4 commit 8c05c51
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
6 changes: 0 additions & 6 deletions apc_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@ time_t apc_time(void)
APCG(request_time) = (time_t) sapi_get_request_time();
return APCG(request_time);
} else {
#ifdef HAVE_CLOCK_GETTIME
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec;
#else
return time(0);
#endif
}
}

Expand Down
1 change: 0 additions & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ if test "$PHP_APCU" != "no"; then
fi
fi

AC_CHECK_FUNCS(clock_gettime)
AC_CHECK_FUNCS(sigaction)
AC_CACHE_CHECK(for union semun, php_cv_semun,
[
Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
-
- Revert use of monotonic clock for TTL (#451)
</notes>
<contents>
<dir name="/">
Expand Down

0 comments on commit 8c05c51

Please sign in to comment.