function TIME(TO)

define TO as an integer variable


select case TO
    case .TO.ENTER
        return with (ADJUSTOR.X - ENTER.X) / TV.VELOCITY
    case .TO.EXIT
        return with (-ENTER.X - PASS.X) / TV.VELOCITY
    case .TO.INSPECT
        return with UNIFORM.F(1.5, 3.0, STREAM)
    case .TO.ADJUST
        return with UNIFORM.F(5.0, 12.5, STREAM)
    case .TO.GOTO.INSPECTION
        return with (INSPECTOR.Y - ADJUSTED.Y) / TV.VELOCITY
    case .TO.GOTO.ADJUSTMENT
        return with (FAIL.Y - ADJUSTOR.Y) / TV.VELOCITY
    case .TO.UPDATE.GRAPHS
        return with GRAPH.UPDATE.INTERVAL
endselect

end
