Skip to content

Commit f12b0de

Browse files
MaxKellermannnikic
authored andcommitted
apc_time: convert apc_time() to function
1 parent 8b321d8 commit f12b0de

File tree

4 files changed

+53
-9
lines changed

4 files changed

+53
-9
lines changed

apc_time.c

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
+----------------------------------------------------------------------+
3+
| APC |
4+
+----------------------------------------------------------------------+
5+
| Copyright (c) 2006-2011 The PHP Group |
6+
+----------------------------------------------------------------------+
7+
| This source file is subject to version 3.01 of the PHP license, |
8+
| that is bundled with this package in the file LICENSE, and is |
9+
| available through the world-wide-web at the following url: |
10+
| http://www.php.net/license/3_01.txt |
11+
| If you did not receive a copy of the PHP license and are unable to |
12+
| obtain it through the world-wide-web, please send a note to |
13+
| license@php.net so we can mail you a copy immediately. |
14+
+----------------------------------------------------------------------+
15+
16+
This software was contributed to PHP by Community Connect Inc. in 2002
17+
and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1.
18+
Future revisions and derivatives of this source code must acknowledge
19+
Community Connect Inc. as the original contributor of this module by
20+
leaving this note intact in the source code.
21+
22+
All other licensing and usage conditions are those of the PHP Group.
23+
24+
*/
25+
26+
#include "apc_time.h"
27+
#include "apc_globals.h"
28+
#include "SAPI.h"
29+
30+
time_t apc_time(void)
31+
{
32+
if (APCG(use_request_time)) {
33+
if (!APCG(request_time))
34+
APCG(request_time) = (time_t) sapi_get_request_time();
35+
return APCG(request_time);
36+
} else {
37+
return time(0);
38+
}
39+
}
40+
41+
/*
42+
* Local variables:
43+
* tab-width: 4
44+
* c-basic-offset: 4
45+
* End:
46+
* vim>600: noexpandtab sw=4 ts=4 sts=4 fdm=marker
47+
* vim<600: noexpandtab sw=4 ts=4 sts=4
48+
*/

apc_time.h

+3-9
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,9 @@
2626
#ifndef APC_TIME_H
2727
#define APC_TIME_H
2828

29-
#include "apc_globals.h"
30-
#include "SAPI.h"
31-
32-
#define apc_time() \
33-
(APCG(use_request_time) \
34-
? (APCG(request_time) \
35-
? APCG(request_time) \
36-
: (APCG(request_time) = (time_t) sapi_get_request_time())) \
37-
: time(0))
29+
#include <time.h>
30+
31+
time_t apc_time(void);
3832

3933
#endif
4034

config.m4

+1
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ if test "$PHP_APCU" != "no"; then
237237
apc_sma.c \
238238
apc_stack.c \
239239
apc_signal.c \
240+
apc_time.c \
240241
apc_iterator.c \
241242
apc_persist.c"
242243

config.w32

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ if(PHP_APCU != 'no')
1212
'apc_sma.c ' +
1313
'apc_stack.c ' +
1414
'apc_signal.c ' +
15+
'apc_time.c ' +
1516
'apc_iterator.c ' +
1617
'apc_persist.c';
1718

0 commit comments

Comments
 (0)