From fc617333a61b05f2cbc3ac4aa2be15084eeede6f Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 4 Mar 2010 12:57:07 +0000 Subject: [PATCH] 2010-03-04 13:56 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbtpathy/telepath.prg ! Restored for real. --- harbour/ChangeLog | 4 +++ harbour/contrib/hbtpathy/telepath.prg | 35 ++++++++++----------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ec4ff448a3..dd8627312e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,10 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-03-04 13:56 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbtpathy/telepath.prg + ! Restored for real. + 2010-03-04 13:12 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbtpathy/telepath.prg ! Restored original before-millisec/midnight fix state. diff --git a/harbour/contrib/hbtpathy/telepath.prg b/harbour/contrib/hbtpathy/telepath.prg index 8e11e4b81a..fb900d4803 100644 --- a/harbour/contrib/hbtpathy/telepath.prg +++ b/harbour/contrib/hbtpathy/telepath.prg @@ -131,13 +131,13 @@ PROCEDURE tp_delay( nTime ) FUNCTION tp_close( nPort, nTimeout ) + DEFAULT nTimeout TO 0 + /* Clipper returns 0 even if a port is not open */ IF ! isopenport( nPort ) RETURN 0 ENDIF - DEFAULT nTimeout TO 0 - IF nTimeout > 0 tp_flush( nPort, nTimeout ) ENDIF @@ -276,12 +276,10 @@ FUNCTION tp_recv( nPort, nLength, nTimeout ) FetchChars( nPort ) - nTimeOut *= 1000 - - nDone := hb_milliSeconds() + iif( nTimeout >= 0, nTimeout, 0 ) + nDone := Seconds() + iif( nTimeout >= 0, nTimeout, 0 ) DO WHILE Len( t_aPorts[ nPort, TPFP_INBUF ] ) < nLength .AND.; - ( nTimeout < 0 .OR. hb_milliSeconds() < nDone ) + ( nTimeout < 0 .OR. Seconds() < nDone ) IF ! tp_idle() FetchChars( nPort ) @@ -315,13 +313,11 @@ FUNCTION tp_send( nPort, cString, nTimeout ) RETURN 0 ENDIF - nTimeOut *= 1000 - - nDone := hb_milliSeconds() + iif( nTimeout >= 0, nTimeout, 0) + nDone := Seconds() + iif( nTimeout >= 0, nTimeout, 0) nTotWritten := 0 DO WHILE nTotWritten < Len( cString ) .AND. ; - ( nTimeout < 0 .OR. hb_milliSeconds() <= nDone ) + ( nTimeout < 0 .OR. Seconds() <= nDone ) nWritten := __tp_WritePort( t_aPorts[ nPort, TPFP_HANDLE ], SubStr( cString, nTotWritten + 1 ) ) @@ -379,11 +375,9 @@ FUNCTION tp_recvto( nPort, cDelim, nMaxlen, nTimeout ) RETURN "" ENDIF - nTimeOut *= 1000 + nDone := Seconds() + iif( nTimeout >= 0, nTimeout, 0 ) - nDone := hb_milliSeconds() + iif( nTimeout >= 0, nTimeout, 0 ) - - DO WHILE ( nTimeout < 0 .OR. hb_milliSeconds() < nDone ) + DO WHILE ( nTimeout < 0 .OR. Seconds() < nDone ) IF Len( cDelim ) == 1 @@ -649,7 +643,7 @@ FUNCTION tp_iscts( nPort ) // I'll wait as long as it takes to drain the port. FUNCTION tp_flush( nPort, nTimeout ) - //LOCAL nStart := hb_milliSeconds() + //LOCAL nStart := Seconds() LOCAL nRes DEFAULT nTimeout TO 0 @@ -662,9 +656,8 @@ FUNCTION tp_flush( nPort, nTimeout ) // Sleep rest of timeout /* - nTimeOut *= 1000 - IF nTimeout > 0 .AND. hb_milliSeconds() - nStart < nTimeout - hb_idleSleep( nTimeout - ( hb_milliSeconds() - nStart ) ) + IF nTimeout > 0 .AND. Seconds() - nStart < nTimeout + hb_idleSleep( nTimeout - ( Seconds() - nStart ) ) ENDIF */ @@ -688,12 +681,10 @@ FUNCTION tp_flush( nPort, nTimeout ) nTimeout := 1800 ENDIF - nTimeOut *= 1000 - - nDone := hb_milliSeconds() + iif( nTimeout >= 0, nTimeout, 0 ) + nDone := Seconds() + iif( nTimeout >= 0, nTimeout, 0 ) DO WHILE tp_OutFree( nPort ) > 0 .AND. ; - ( nTimeout < 0 .OR. hb_milliSeconds() < nDone ) + ( nTimeout < 0 .OR. Seconds() < nDone ) hb_IdleState() ENDDO