|
|
DataMuseum.dkPresents historical artifacts from the history of: RegneCentralen RC759 "Piccoline" |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RegneCentralen RC759 "Piccoline" Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1397 (0x575)
Types: TextFile
Names: »STR2TVAL.TXT«
└─⟦6a1b9f2c5⟧ Bits:30005310/disk3.imd Open Access II v2.10 (dansk)
└─⟦this⟧ »STR2TVAL.TXT«
! STR2TVAL - converts time string to time numeric values
! Send in Variables:
! TIMESTR: (string) must have time string in 24 hour format or AM/PM format
! if invalid string uses SYSTEM TIME
! Returned Variables:
! HOURS,MINUTES,SECONDS: (integer) values parsed from TIMESTR, hours in
! 24 hour format.
! TVAL: (floating point) total number of seconds. TVAL can be used for
! time computations or stored in a DECIMAL variable in the database
IF (LENGTH(timestr) < 8) !no or invalid time string - get system time
timestr = SYSTIME
END IF
IF POS("PM",timestr,1) > 0
addpm = 12 ! for 24 time computation
ELSE
addpm = 0
END IF
!assume timestr in 00:00:00 format - retrieve hours,minutes,seconds
hours = INT(VAL(EXTRACT(timestr,1,2)))
minutes = INT(VAL(EXTRACT(timestr,4,2)))
seconds = INT(VAL(EXTRACT(timestr,7,2)))
IF (addpm = 12) AND (hours = 12)
addpm = 0
END IF
! hours returned in 24 hour time
hours = hours + addpm
! compute total # of seconds into a floating point TVAL
tval = ((hours*3600)+(minutes*60)+seconds)*1.0
! DEBUG
PUT "STR2TVAL: TIME = ",TIMESTR, DO NEWLINE
PUT "STR2TVAL: HOURS = ",hours, " MINUTES = ",minutes, ØØ
" SECONDS = ",seconds, DO NEWLINE
PUT "STR2TVAL: TVAL = ",tval, DO NEWLINE
B = TRUE; GET B
!end temp variables
addpm END
b END