dmitry Fri Oct 26 04:46:13 2007 UTC
Modified files: (Branch: PHP_5_3)
/php-src/sapi/cgi cgi_main.c
Log:
Added check for HAVE_GETTIMEOFDAY
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.50.2.6&r2=1.267.2.15.2.50.2.7&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.6
php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.7
--- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.6 Thu Oct 25 10:01:30 2007
+++ php-src/sapi/cgi/cgi_main.c Fri Oct 26 04:46:12 2007
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cgi_main.c,v 1.267.2.15.2.50.2.6 2007/10/25 10:01:30 jani Exp $ */
+/* $Id: cgi_main.c,v 1.267.2.15.2.50.2.7 2007/10/26 04:46:12 dmitry Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -1261,7 +1261,11 @@
fcgi_request request;
int repeats = 1;
int benchmark = 0;
+#if HAVE_GETTIMEOFDAY
struct timeval start, end;
+#else
+ time_t start, end;
+#endif
#ifndef PHP_WIN32
int status = 0;
#endif
@@ -1541,7 +1545,11 @@
case 'T':
benchmark = 1;
repeats = atoi(php_optarg);
+#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&start, NULL);
+#else
+ time(&start);
+#endif
break;
case 'h':
case '?':
@@ -1960,6 +1968,7 @@
out:
if (benchmark) {
int sec;
+#ifdef HAVE_GETTIMEOFDAY
int usec;
gettimeofday(&end, NULL);
@@ -1971,6 +1980,11 @@
usec = (int)(end.tv_usec + 1000000 - start.tv_usec);
}
fprintf(stderr, "\nElapsed time: %d.%06d sec\n", sec, usec);
+#else
+ time(&end);
+ sec = (int)(end - start);
+ fprintf(stderr, "\nElapsed time: %d sec\n", sec);
+#endif
}
SG(server_context) = NULL;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php