% % analyze the time code string input % % stack: time-str % % possible formats are: D:H:M, H:M, M -- D H M, H M % ":" " " replall " " " " replall " " " " replall " " " " replall " " " " replall trim " " 1 0 3 parse third numeric { second numeric { dup numeric { % % all three tokens numeric, calc days, hours, minutes % rot 24 mul rot add 60 mul add } { % % first two tokens numeric, return hours and minutes calc % pop exch 60 mul add } ifelse } { % % only first token numeric, return as minutes % pop2 } ifelse } { % % not numeric, return 0 for answer % pop3 0 } ifelse % % minutes calc return, zero for empty or no valid numerics % % stack: minutes %