dmitry Fri Oct 26 04:46:28 2007 UTC
Modified files:
/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.342&r2=1.343&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.342 php-src/sapi/cgi/cgi_main.c:1.343
--- php-src/sapi/cgi/cgi_main.c:1.342 Thu Oct 25 10:01:25 2007
+++ php-src/sapi/cgi/cgi_main.c Fri Oct 26 04:46:28 2007
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cgi_main.c,v 1.342 2007/10/25 10:01:25 jani Exp $ */
+/* $Id: cgi_main.c,v 1.343 2007/10/26 04:46:28 dmitry Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -1270,7 +1270,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
@@ -1551,7 +1555,11 @@
case 'T':
benchmark = 1;
repeats = atoi(php_optarg);
+#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&start, NULL);
+#else
+ time(&start);
+#endif
break;
case 'h':
case '?':
@@ -1965,6 +1973,7 @@
out:
if (benchmark) {
int sec;
+#ifdef HAVE_GETTIMEOFDAY
int usec;
gettimeofday(&end, NULL);
@@ -1976,6 +1985,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