Re: cvs: php-src / NEWS /main SAPI.c SAPI.h /sapi/apache mod_php5.c /sapi/apache2filter sapi_apache2.c /sapi/apache2handler sapi_apache2.c
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: cvs: php-src / NEWS /main SAPI.c SAPI.h /sapi/apache mod_php5.c /sapi/apache2filter sapi_apache2.c /sapi/apache2handler sapi_apache2.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-28275@lists.php.net to get a copy of this message | ||
On Tue, 10 Aug 2004, Andi Gutmans wrote:
Haven't run the code but it seems that if sapi_get_request_time() is not defined then you will return the same time() for each consecutive request (i.e. you don't reset it each request). It's probably better to move the time(0) initialization to sapi_globals ctor and/or dtor.Hrm.. Isn't that what I did? The code is:
SAPI_API time_t sapi_get_request_time(TSRMLS_D) {
if (sapi_module.get_request_time) {
return sapi_module.get_request_time(TSRMLS_C);
} else {
if(!SG(global_request_time)) SG(global_request_time) = time(0);
return SG(global_request_time);
}
}
So I store the time in the sapi_globals_struct which is zeroed on each request, so only subsequent calls to sapi_get_request_time() during the same request will get the same time which is what I think people would expect.
-Rasmus