I will try to explain this as best I can...
I have a device connect to a patient that records data every 4 seconds.
The idea is the the patient wears the device all night.
Sometimes the patient will either turn off or disconnect the device to go to the bathroom.
Or it falls off during sleep and at some point they wake up and reconnect it.
When this happens, a new file will get created in the device.
Here is my problem ... I need this to be a continuous file (including the time the device was off/disconnected).
Let's say the patient only did this once ... leaving me with 2 files.
I have no problem if it happens in the same day as I simply add a new entry and just leave it blank every 4 seconds.
I do this using this basic idea:
Local cTime1:="22:15:00" //time the device was disconnected
Local cTime2:="23:30:45" //time the device was reconnected
do while cTime1 < cTime2
APPEND BLANK
cTime1 := GetNewTime( cTime1, 4 )
DataFile->Time := cTime1
enddo
STATIC FUNCTION GetNewTime( cTimeStart, nSec )
LOCAL nHour, nMin
nSec = ( VAL( LEFT( cTimeStart, 2 ) ) * 3600 + VAL( SUBSTR( cTimeStart, 4, 2 ) ) * 60 + VAL( RIGHT( cTimeStart, 2 ) ) + nSec ) % 86400
nHour = INT( nSec / 3600 )
nSec -= nHour * 3600
nMin = INT( nSec / 60 )
nSec -= nMin * 60
cTimeStart := STRZERO( nHour, 2 ) + ":" + STRZERO( nMin, 2 ) + ":" + STRZERO( nSec, 2 )
RETURN cTimeStartI run into a problem if the disconnect is over 2 different days.
cTime1:="23:45:00" and cTime2:="01:30:00"
In this situation, cTime1 will always be less than cTime2.
Any ideas are welcome
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)