% % format time in hh/mm format % % stack: time-text % Time.Now Time.Timels pop !minutes !hours % % check for a hyphen % 0 !addhrs "pm" found? { 12 !addhrs "pm" empty replall } if "am" found? { 0 !addhrs "am" empty replall } if % % not a displace negative % reduce all specials to spaces % ":" " " replall "/" " " replall "," " " replall "-" empty replall "." found? { % % this is a fraction of an hour % assumed to be negative displace % dup numeric { dup normint dup rot from 60 mul normint ^" " & ^"-" *formtimf } { % % not a proper number % pop } ifelse } { % % this should be a normal formatted time % " " 0 2 1 parse % % stack: hours mins % any? { dup numeric { % % proper numeric minutes % dup 60 lt { !minutes % % analyze the hours % dup numeric { % % proper numeric hours % dup 24 lt { % % proper value for hours % _addhrs add !hours } { % % not in proper hours range % pop } ifelse } { % % not proper hours % pop } ifelse } { % % not a proper minutes value % pop2 } ifelse } { % % not a proper number for minutes % pop2 } ifelse } { % % there are no minutes, the hours field must mean minutes negative % 60 divmod ^" " & ^"-" *formtimf } ifelse } ifelse