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

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to