diff --git a/apc_time.c b/apc_time.c new file mode 100644 index 00000000..8b2b1aea --- /dev/null +++ b/apc_time.c @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | APC | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2011 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + + This software was contributed to PHP by Community Connect Inc. in 2002 + and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. + Future revisions and derivatives of this source code must acknowledge + Community Connect Inc. as the original contributor of this module by + leaving this note intact in the source code. + + All other licensing and usage conditions are those of the PHP Group. + + */ + +#include "apc_time.h" +#include "apc_globals.h" +#include "SAPI.h" + +time_t apc_time(void) +{ + if (APCG(use_request_time)) { + if (!APCG(request_time)) + APCG(request_time) = (time_t) sapi_get_request_time(); + return APCG(request_time); + } else { + return time(0); + } +} + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim>600: noexpandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: noexpandtab sw=4 ts=4 sts=4 + */ diff --git a/apc_time.h b/apc_time.h index 9ceff2cf..3e264039 100644 --- a/apc_time.h +++ b/apc_time.h @@ -26,15 +26,9 @@ #ifndef APC_TIME_H #define APC_TIME_H -#include "apc_globals.h" -#include "SAPI.h" - -#define apc_time() \ - (APCG(use_request_time) \ - ? (APCG(request_time) \ - ? APCG(request_time) \ - : (APCG(request_time) = (time_t) sapi_get_request_time())) \ - : time(0)) +#include + +time_t apc_time(void); #endif diff --git a/config.m4 b/config.m4 index a4e6dc2b..2bac9a07 100644 --- a/config.m4 +++ b/config.m4 @@ -237,6 +237,7 @@ if test "$PHP_APCU" != "no"; then apc_sma.c \ apc_stack.c \ apc_signal.c \ + apc_time.c \ apc_iterator.c \ apc_persist.c" diff --git a/config.w32 b/config.w32 index 712fba7f..8ed38851 100644 --- a/config.w32 +++ b/config.w32 @@ -12,6 +12,7 @@ if(PHP_APCU != 'no') 'apc_sma.c ' + 'apc_stack.c ' + 'apc_signal.c ' + + 'apc_time.c ' + 'apc_iterator.c ' + 'apc_persist.c';