presto-main/src/main/java/io/prestosql/type/TimeOperators.java/TimeOperators/castFromSlice
class TimeOperators:    @ScalarOperator(CAST)
    @LiteralParameters("x")
    @SqlType(StandardTypes.TIME)
    public static long castFromSlice(ConnectorSession session, @SqlType("varchar(x)") Slice value)
    {
        try {
            if (session.isLegacyTimestamp()) {
                return parseTimeWithoutTimeZone(session.getTimeZoneKey(), value.toStringUtf8());
            }
            return parseTimeWithoutTimeZone(value.toStringUtf8());
        }
        catch (IllegalArgumentException e) {
            throw new PrestoException(INVALID_CAST_ARGUMENT, "Value cannot be cast to time: " + value.toStringUtf8(), e);
        }
    }