Hi James,
here is a revised version of the functions with a small sample. Now they handle the hours also.
#include "Fivewin.ch"
PROCEDURE Main ()
LOCAL cTime := ""
LOCAL nTime := Time2Dec ("08:45:30")
MsgInfo ("Time: 08:45:30, decimal: "+Str (nTime,12,8)+CRLF+;
     "decimal: "+Str (nTime,12,8)+", Time: "+ Dec2Time(nTime),;
     "Convert Time to decimal and vice versa")
RETURN (nil)
// Convert a timestring to its decimal equivalent
//-----------------------------------------------
Function Time2Dec (cTime)
 LOCAL nTime := 0.0, nDec := 0.0
 LOCAL nHour := VAL (StrToken (cTime, 1,":"))
 LOCAL nMin  := VAL (StrToken (cTime, 2,":"))
 LOCAL nSec  := VAL (StrToken (cTime, 3,":"))
Â
 nDec := ((nMin*60)+nSec)*100/3600
 nTime := nHour + (nDec/100)
Return (nTime)
// convert decimal time back to real time
//-----------------------------------------
Function Dec2Time (nDec)
 LOCAL cTime := ""
 Local nTemp := Frac (nDec)*60
 LOCAL nHour := INT (nDec)
 Local nMin  := Int (nTemp)
 Local nSec  := (nTemp-nMin)*60
 cTime := StrZero (nHour,2,0)+":"+StrZero(nMin,2)+":"+StrZero(nSec,2)
Return (cTime)
// get the fraction of a decimal number
//-------------------------------------
FUNCTION Frac (nNum)
RETURN ( ABS(nNum)-Floor(ABS(nNum)) )
I made some tests with SET DECIMAL, this setting has no influence on the calculation. SET DECIMALS only affects the output on the screen, but only if SET FIXED is ON. IF SET FIXED is OFF, SET DECIMALS is ignored.