cvs: php4 /ext/standard basic_functions.c microtime.c microtime.h
| From: | Marcus B�rger | Date: | Tue, 29 Oct 2002 23:35:49 +0000 |
| Subject: | cvs: php4 /ext/standard basic_functions.c microtime.c microtime.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-15617@lists.php.net to get a copy of this message | ||
helly Tue Oct 29 18:35:49 2002 EDT
Modified files:
/php4/ext/standard basic_functions.c microtime.c microtime.h
Log:
make microtime and gettimeofday unavailable instead of return false return
false in case needed library function is unavailable.
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.538 php4/ext/standard/basic_functions.c:1.539
--- php4/ext/standard/basic_functions.c:1.538 Fri Oct 25 15:33:09 2002
+++ php4/ext/standard/basic_functions.c Tue Oct 29 18:35:49 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.538 2002/10/25 19:33:09 iliaa Exp $ */
+/* $Id: basic_functions.c,v 1.539 2002/10/29 23:35:49 helly Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -508,8 +508,10 @@
PHP_FE(getopt, NULL)
#endif
+#ifdef HAVE_GETTIMEOFDAY
PHP_FE(microtime, NULL)
PHP_FE(gettimeofday, NULL)
+#endif
#ifdef HAVE_GETRUSAGE
PHP_FE(getrusage, NULL)
Index: php4/ext/standard/microtime.c
diff -u php4/ext/standard/microtime.c:1.38 php4/ext/standard/microtime.c:1.39
--- php4/ext/standard/microtime.c:1.38 Fri Sep 6 03:44:30 2002
+++ php4/ext/standard/microtime.c Tue Oct 29 18:35:49 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: microtime.c,v 1.38 2002/09/06 07:44:30 hyanantha Exp $ */
+/* $Id: microtime.c,v 1.39 2002/10/29 23:35:49 helly Exp $ */
#include "php.h"
@@ -53,9 +53,9 @@
/* {{{ proto string microtime(void)
Returns a string containing the current time in seconds and microseconds */
+#ifdef HAVE_GETTIMEOFDAY
PHP_FUNCTION(microtime)
{
-#ifdef HAVE_GETTIMEOFDAY
struct timeval tp;
long sec = 0L;
double msec = 0.0;
@@ -68,17 +68,18 @@
if (msec >= 1.0) msec -= (long) msec;
snprintf(ret, 100, "%.8f %ld", msec, sec);
RETVAL_STRING(ret,1);
- } else
-#endif
+ } else {
RETURN_FALSE;
+ }
}
+#endif
/* }}} */
/* {{{ proto array gettimeofday(void)
Returns the current time as array */
+#ifdef HAVE_GETTIMEOFDAY
PHP_FUNCTION(gettimeofday)
{
-#ifdef HAVE_GETTIMEOFDAY
struct timeval tp;
struct timezone tz;
@@ -95,10 +96,11 @@
#endif
add_assoc_long(return_value, "dsttime", tz.tz_dsttime);
return;
- } else
-#endif
- RETURN_FALSE;
+ } else {
+ RETURN_FALSE;
+ }
}
+#endif
/* }}} */
#ifdef HAVE_GETRUSAGE
Index: php4/ext/standard/microtime.h
diff -u php4/ext/standard/microtime.h:1.9 php4/ext/standard/microtime.h:1.10
--- php4/ext/standard/microtime.h:1.9 Thu Feb 28 03:26:46 2002
+++ php4/ext/standard/microtime.h Tue Oct 29 18:35:49 2002
@@ -16,13 +16,17 @@
+----------------------------------------------------------------------+
*/
-/* $Id: microtime.h,v 1.9 2002/02/28 08:26:46 sebastian Exp $ */
+/* $Id: microtime.h,v 1.10 2002/10/29 23:35:49 helly Exp $ */
#ifndef MICROTIME_H
#define MICROTIME_H
+#ifdef HAVE_GETTIMEOFDAY
PHP_FUNCTION(microtime);
PHP_FUNCTION(gettimeofday);
+#endif
+#ifdef HAVE_GETRUSAGE
PHP_FUNCTION(getrusage);
+#endif
#endif /* MICROTIME_H */