]> granicus.if.org Git - php/commitdiff
- always convert apr_time_t to time_t using apr_time_sec() to be future-proof.
authorJoe Orton <jorton@php.net>
Sat, 23 Oct 2004 13:48:05 +0000 (13:48 +0000)
committerJoe Orton <jorton@php.net>
Sat, 23 Oct 2004 13:48:05 +0000 (13:48 +0000)
- print apr_time_t values using APR_TIME_T and apr_snprintf.
- remove redundant add_property_long calls.

sapi/apache2filter/php_functions.c
sapi/apache2filter/sapi_apache2.c
sapi/apache2handler/php_functions.c
sapi/apache2handler/sapi_apache2.c

index b3ac9c2c099569bc1e12a02a926fdc7304ba742c..8f0a29352889536a4167e357bd4e541af1c83a17 100644 (file)
@@ -92,7 +92,7 @@ PHP_FUNCTION(virtual)
 #define ADD_LONG(name) \
                add_property_long(return_value, #name, rr->name)
 #define ADD_TIME(name) \
-               add_property_long(return_value, #name, rr->name / APR_USEC_PER_SEC);
+               add_property_long(return_value, #name, apr_time_sec(rr->name));
 #define ADD_STRING(name) \
                if (rr->name) add_property_string(return_value, #name, (char *) rr->name, 1)
 
@@ -138,7 +138,6 @@ PHP_FUNCTION(apache_lookup_uri)
                ADD_LONG(allowed);
                ADD_LONG(sent_bodyct);
                ADD_LONG(bytes_sent);
-               ADD_LONG(request_time);
                ADD_LONG(mtime);
                ADD_TIME(request_time);
 
index ffc8dfbd5bc3baad1c4709f099fad9f3b6a13d3c..2257b76c79614b9ba0515006f8ec70d8ea4bec48 100644 (file)
@@ -174,13 +174,13 @@ php_apache_sapi_get_stat(TSRMLS_D)
        ctx->finfo.st_dev = ctx->r->finfo.device;
        ctx->finfo.st_ino = ctx->r->finfo.inode;
 #ifdef NETWARE
-       ctx->finfo.st_atime.tv_sec = ctx->r->finfo.atime/1000000;
-       ctx->finfo.st_mtime.tv_sec = ctx->r->finfo.mtime/1000000;
-       ctx->finfo.st_ctime.tv_sec = ctx->r->finfo.ctime/1000000;
+       ctx->finfo.st_atime.tv_sec = apr_time_sec(ctx->r->finfo.atime);
+       ctx->finfo.st_mtime.tv_sec = apr_time_sec(ctx->r->finfo.mtime);
+       ctx->finfo.st_ctime.tv_sec = apr_time_sec(ctx->r->finfo.ctime);
 #else
-       ctx->finfo.st_atime = ctx->r->finfo.atime/1000000;
-       ctx->finfo.st_mtime = ctx->r->finfo.mtime/1000000;
-       ctx->finfo.st_ctime = ctx->r->finfo.ctime/1000000;
+       ctx->finfo.st_atime = apr_time_sec(ctx->r->finfo.atime);
+       ctx->finfo.st_mtime = apr_time_sec(ctx->r->finfo.mtime);
+       ctx->finfo.st_ctime = apr_time_sec(ctx->r->finfo.ctime);
 #endif
 
        ctx->finfo.st_size = ctx->r->finfo.size;
index fca55d9c33020faafc20ccb4d8df550a61433ecd..4c043711e5ec7f107f635120e5b512437c850238 100644 (file)
@@ -110,7 +110,7 @@ PHP_FUNCTION(virtual)
 #define ADD_LONG(name) \
                add_property_long(return_value, #name, rr->name)
 #define ADD_TIME(name) \
-               add_property_long(return_value, #name, rr->name / APR_USEC_PER_SEC);
+               add_property_long(return_value, #name, apr_time_sec(rr->name));
 #define ADD_STRING(name) \
                if (rr->name) add_property_string(return_value, #name, (char *) rr->name, 1)
 
@@ -156,7 +156,6 @@ PHP_FUNCTION(apache_lookup_uri)
                ADD_LONG(allowed);
                ADD_LONG(sent_bodyct);
                ADD_LONG(bytes_sent);
-               ADD_LONG(request_time);
                ADD_LONG(mtime);
                ADD_TIME(request_time);
 
@@ -402,7 +401,9 @@ PHP_MINFO_FUNCTION(apache)
        sprintf(tmp, "Per Child: %d - Keep Alive: %s - Max Per Connection: %d", max_requests, (serv->keep_alive ? "on":"off"), serv->keep_alive_max);
        php_info_print_table_row(2, "Max Requests", tmp);
 
-       sprintf(tmp, "Connection: %lld - Keep-Alive: %lld", (serv->timeout / 1000000), (serv->keep_alive_timeout / 1000000));
+       apr_snprintf(tmp, sizeof tmp,
+                                "Connection: %" APR_TIME_T_FMT " - Keep-Alive: %" APR_TIME_T_FMT, 
+                                apr_time_sec(serv->timeout), apr_time_sec(serv->keep_alive_timeout));
        php_info_print_table_row(2, "Timeouts", tmp);
        
        php_info_print_table_row(2, "Virtual Server", (serv->is_virtual ? "Yes" : "No"));
index 354ab96716d06305b884b0d4842dff936d8cf8b0..2b01f6a1149854a045f7bfb570385a30c1a76ec4 100644 (file)
@@ -169,13 +169,13 @@ php_apache_sapi_get_stat(TSRMLS_D)
        ctx->finfo.st_dev = ctx->r->finfo.device;
        ctx->finfo.st_ino = ctx->r->finfo.inode;
 #if defined(NETWARE) && defined(CLIB_STAT_PATCH)
-       ctx->finfo.st_atime.tv_sec = ctx->r->finfo.atime/1000000;
-       ctx->finfo.st_mtime.tv_sec = ctx->r->finfo.mtime/1000000;
-       ctx->finfo.st_ctime.tv_sec = ctx->r->finfo.ctime/1000000;
+       ctx->finfo.st_atime.tv_sec = apr_time_sec(ctx->r->finfo.atime);
+       ctx->finfo.st_mtime.tv_sec = apr_time_sec(ctx->r->finfo.mtime);
+       ctx->finfo.st_ctime.tv_sec = apr_time_sec(ctx->r->finfo.ctime);
 #else
-       ctx->finfo.st_atime = ctx->r->finfo.atime/1000000;
-       ctx->finfo.st_mtime = ctx->r->finfo.mtime/1000000;
-       ctx->finfo.st_ctime = ctx->r->finfo.ctime/1000000;
+       ctx->finfo.st_atime = apr_time_sec(ctx->r->finfo.atime);
+       ctx->finfo.st_mtime = apr_time_sec(ctx->r->finfo.mtime);
+       ctx->finfo.st_ctime = apr_time_sec(ctx->r->finfo.ctime);
 #endif
 
        ctx->finfo.st_size = ctx->r->finfo.size;