jason Tue Jul 22 03:20:56 2003 EDT
Modified files:
/php-src/ext/sockets sockets.c
/php-src/ext/standard streamsfuncs.c
Log:
Fix EINVAL errors for OS's (Solaris + BSD) that do not appreciate microseconds >= 1
second
Patch submitted from [EMAIL PROTECTED]
Index: php-src/ext/sockets/sockets.c
diff -u php-src/ext/sockets/sockets.c:1.146 php-src/ext/sockets/sockets.c:1.147
--- php-src/ext/sockets/sockets.c:1.146 Tue Jul 8 01:00:13 2003
+++ php-src/ext/sockets/sockets.c Tue Jul 22 03:20:55 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.c,v 1.146 2003/07/08 05:00:13 pollita Exp $ */
+/* $Id: sockets.c,v 1.147 2003/07/22 07:20:55 jason Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -641,8 +641,16 @@
convert_to_long(&tmp);
sec = &tmp;
}
- tv.tv_sec = Z_LVAL_P(sec);
- tv.tv_usec = usec;
+
+ /* Solaris + BSD do not like microsecond values which are >= 1 sec */
+ if (usec > 999999) {
+ tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000);
+ tv.tv_usec = usec % 1000000;
+ } else {
+ tv.tv_sec = Z_LVAL_P(sec);
+ tv.tv_usec = usec;
+ }
+
tv_p = &tv;
if (sec == &tmp) {
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.24
php-src/ext/standard/streamsfuncs.c:1.25
--- php-src/ext/standard/streamsfuncs.c:1.24 Sat Jun 28 07:24:46 2003
+++ php-src/ext/standard/streamsfuncs.c Tue Jul 22 03:20:55 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streamsfuncs.c,v 1.24 2003/06/28 11:24:46 wez Exp $ */
+/* $Id: streamsfuncs.c,v 1.25 2003/07/22 07:20:55 jason Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -563,8 +563,16 @@
/* If seconds is not set to null, build the timeval, else we wait indefinitely
*/
if (sec != NULL) {
convert_to_long_ex(&sec);
- tv.tv_sec = Z_LVAL_P(sec);
- tv.tv_usec = usec;
+
+ /* Solaris + BSD do not like microsecond values which are >= 1 sec */
+ if (usec > 999999) {
+ tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000);
+ tv.tv_usec = usec % 1000000;
+ } else {
+ tv.tv_sec = Z_LVAL_P(sec);
+ tv.tv_usec = usec;
+ }
+
tv_p = &tv;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php