private void handleQueryTime(Sim_event ev)
    {
        int src = -1;   // the sender id
        boolean success = false;
        int tag = -1;
        int transID = -1;

        try
        {
            ARObject obj = (ARObject) ev.get_data();
            double userZone = obj.getTimeZone();
            double resZone  = resource_.getResourceTimeZone();

            long from = obj.getStartTime();
            from = AdvanceReservation.convertTimeZone(from, userZone, resZone);

            long to = from + obj.getDurationTime();
            transID = obj.getTransactionID();
            src = obj.getUserID();

            tag = GridSimTags.RETURN_AR_QUERY_TIME + transID;
            if (policyType_ != ResourceCharacteristics.ADVANCE_RESERVATION) {
                success = false;
            }
            else
            {
                success = true;
                if (ev.get_tag() == GridSimTags.SEND_AR_LIST_FREE_TIME) {
                    ((ARPolicy) policy_).handleQueryFreeTime(from,to,src,tag,userZone);
                }
                else if (ev.get_tag() == GridSimTags.SEND_AR_LIST_BUSY_TIME) {
                    ((ARPolicy) policy_).handleQueryBusyTime(from,to,src,tag,userZone);
                }
            }
        }
        catch (ClassCastException c) {
            success = false;
        }
        catch (Exception e) {
            success = false;
        }

        // if there is an exception, then send back an error msg
        if (!success && tag != -1)
        {
            System.out.println(super.get_name() + " : Error - can't list busy"+
                " or free reservation time.");

            Object[] array = new Object[2];
            array[0] = new Integer(transID);  // [0] = transaction id
            array[1] = null;                  // [1] = list of times, i.e. null

            super.send(src, 0.0, GridSimTags.RETURN_AR_QUERY_TIME,
                       new IO_data(array, super.SIZE, src));
        }
    }