home *** CD-ROM | disk | FTP | other *** search
- /*********
- * TSTOH
- * by Tom Rettig
- * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- *
- * Syntax: TSTOH( <expC> )
- * Return: Numeric hours from <expC> time string.
- * Zero if invalid time string format.
- *********/
-
- #include "trlib.h"
-
- TRTYPE tstoh()
- {
- char *instr;
- double ret;
- if ( PCOUNT == 1 && ISCHAR(1) )
- {
- instr = _parc(1);
- if ( VALIDTIME(instr) )
- {
- ret = (double)
- ( (ADTOL(instr[HOURS])*36000) +
- (ADTOL(instr[HOUR ])* 3600) +
- (ADTOL(instr[MINS ])* 600) +
- (ADTOL(instr[MIN ])* 60) +
- (ADTOL(instr[SECS ])* 10) +
- ADTOL(instr[SEC ]) ) / 3600;
- _retnd( ret );
- }
- else
- _retnd( (double)ERROR );
- }
- else
- _retnd( (double)ERROR );
- }
-
-