about summary refs log tree commit diff
path: root/Functions/TCP/tcp_wait
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/TCP/tcp_wait')
-rw-r--r--Functions/TCP/tcp_wait9
1 files changed, 8 insertions, 1 deletions
diff --git a/Functions/TCP/tcp_wait b/Functions/TCP/tcp_wait
index d18068a66..ee04cf23b 100644
--- a/Functions/TCP/tcp_wait
+++ b/Functions/TCP/tcp_wait
@@ -1,7 +1,14 @@
 # Wait for given number of seconds, reading any data from
 # all TCP connections while doing so.
 
-typeset -F SECONDS to end
+if [[ ${(t)SECONDS} != float* ]]; then
+    # If called from tcp_expect, don't override
+    typeset -F TCP_SECONDS_START=$SECONDS
+    # Get extra accuracy by making SECONDS floating point locally
+    typeset -F SECONDS
+fi
+
+typeset to end
 
 (( to = $1, end = SECONDS + to ))
 while (( SECONDS < end )); do