willow-utils/src/main/java/com/btr/proxy/selector/pac/PacScriptMethods.java
@Override
  public boolean timeRange(Object hour1, Object min1, Object sec1,
      Object hour2, Object min2, Object sec2, Object gmt) {
    boolean useGmt = GMT.equalsIgnoreCase(String.valueOf(min1))
        || GMT.equalsIgnoreCase(String.valueOf(sec1))
        || GMT.equalsIgnoreCase(String.valueOf(min2))
        || GMT.equalsIgnoreCase(String.valueOf(gmt));

    Calendar cal = getCurrentTime(useGmt);
    cal.set(Calendar.MILLISECOND, 0);
    Date current = cal.getTime();
    Date from;
    Date to;
    if (sec2 instanceof Number) {
      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
      cal.set(Calendar.MINUTE, ((Number) min1).intValue());
      cal.set(Calendar.SECOND, ((Number) sec1).intValue());
      from = cal.getTime();

      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour2).intValue());
      cal.set(Calendar.MINUTE, ((Number) min2).intValue());
      cal.set(Calendar.SECOND, ((Number) sec2).intValue());
      to = cal.getTime();
    } else if (hour2 instanceof Number) {
      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
      cal.set(Calendar.MINUTE, ((Number) min1).intValue());
      cal.set(Calendar.SECOND, 0);
      from = cal.getTime();

      cal.set(Calendar.HOUR_OF_DAY, ((Number) sec1).intValue());
      cal.set(Calendar.MINUTE, ((Number) hour2).intValue());
      cal.set(Calendar.SECOND, 59);
      to = cal.getTime();
    } else if (min1 instanceof Number) {
      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
      cal.set(Calendar.MINUTE, 0);
      cal.set(Calendar.SECOND, 0);
      from = cal.getTime();

      cal.set(Calendar.HOUR_OF_DAY, ((Number) min1).intValue());
      cal.set(Calendar.MINUTE, 59);
      cal.set(Calendar.SECOND, 59);
      to = cal.getTime();
    } else {
      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
      cal.set(Calendar.MINUTE, 0);
      cal.set(Calendar.SECOND, 0);
      from = cal.getTime();

      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
      cal.set(Calendar.MINUTE, 59);
      cal.set(Calendar.SECOND, 59);
      to = cal.getTime();
    }

    if (to.before(from)) {
      cal.setTime(to);
      cal.add(Calendar.DATE, +1);
      to = cal.getTime();
    }

    return current.compareTo(from) >= 0 && current.compareTo(to) <= 0;
  }
@Override
  public boolean timeRange(Object hour1, Object min1, Object sec1,
      Object hour2, Object min2, Object sec2, Object gmt) {
    boolean useGmt = GMT.equalsIgnoreCase(String.valueOf(min1))
        || GMT.equalsIgnoreCase(String.valueOf(sec1))
        || GMT.equalsIgnoreCase(String.valueOf(min2))
        || GMT.equalsIgnoreCase(String.valueOf(gmt));

    Calendar cal = getCurrentTime(useGmt);
    cal.set(Calendar.MILLISECOND, 0);
    Date current = cal.getTime();
    Date from;
    Date to;
    if (sec2 instanceof Number) {
      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
      cal.set(Calendar.MINUTE, ((Number) min1).intValue());
      cal.set(Calendar.SECOND, ((Number) sec1).intValue());
      from = cal.getTime();

      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour2).intValue());
      cal.set(Calendar.MINUTE, ((Number) min2).intValue());
      cal.set(Calendar.SECOND, ((Number) sec2).intValue());
      to = cal.getTime();
    } else if (hour2 instanceof Number) {
      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
      cal.set(Calendar.MINUTE, ((Number) min1).intValue());
      cal.set(Calendar.SECOND, 0);
      from = cal.getTime();

      cal.set(Calendar.HOUR_OF_DAY, ((Number) sec1).intValue());
      cal.set(Calendar.MINUTE, ((Number) hour2).intValue());
      cal.set(Calendar.SECOND, 59);
      to = cal.getTime();
    } else if (min1 instanceof Number) {
      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
      cal.set(Calendar.MINUTE, 0);
      cal.set(Calendar.SECOND, 0);
      from = cal.getTime();

      cal.set(Calendar.HOUR_OF_DAY, ((Number) min1).intValue());
      cal.set(Calendar.MINUTE, 59);
      cal.set(Calendar.SECOND, 59);
      to = cal.getTime();
    } else {
      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
      cal.set(Calendar.MINUTE, 0);
      cal.set(Calendar.SECOND, 0);
      from = cal.getTime();

      cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
      cal.set(Calendar.MINUTE, 59);
      cal.set(Calendar.SECOND, 59);
      to = cal.getTime();
    }

    if (to.before(from)) {
      cal.setTime(to);
      cal.add(Calendar.DATE, +1);
      to = cal.getTime();
    }

    return current.compareTo(from) >= 0 && current.compareTo(to) <= 0;
  }
***********************************************************************
Some parameters can be left out therefore the meaning of the parameters
changes. The method definition shows the version with the most possible
parameters filled. The real meaning of the parameters is guessed from it's
value. If "from" and "to" are specified then the bounds are inclusive. If
the "GMT" parameter is specified, times are taken to be in GMT, otherwise
the local time zone is used.<br/>

<pre>
timeRange(hour)
timeRange(hour1, hour2)
timeRange(hour1, min1, hour2, min2)
timeRange(hour1, min1, sec1, hour2, min2, sec2)
timeRange(hour1, min1, sec1, hour2, min2, sec2, gmt)
</pre>

@param hour1
is the hour from 0 to 23. (0 is midnight, 23 is 11 pm.)
@param min1
minutes from 0 to 59.
@param sec1
seconds from 0 to 59.
@param hour2
is the hour from 0 to 23. (0 is midnight, 23 is 11 pm.)
@param min2
minutes from 0 to 59.
@param sec2
seconds from 0 to 59.
@param gmt
"GMT" for gmt time format else "undefined"
@return true if the current time matches the given range.
**********************************************************************