public static TimeValue parseTimeValue(String sValue, TimeValue defaultValue) {
       if (sValue == null) {
           return defaultValue;
       }
       
       long millis;
       if (sValue.endsWith("S")) {
           millis = Long.parseLong(sValue.substring(0, sValue.length() - 1));
       } else if (sValue.endsWith("ms")) {
           millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - "ms".length())));
       } else if (sValue.endsWith("s")) {
           millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 1000);
       } else if (sValue.endsWith("m")) {
           millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 60 * 1000);
       } else if (sValue.endsWith("H") || sValue.endsWith("h")) {
           millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 60 * 60 * 1000);
       } else if (sValue.endsWith("d")) {
           millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 24 * 60 * 60 * 1000);
       } else if (sValue.endsWith("w")) {
           millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 7 * 24 * 60 * 60 * 1000);
       } else {
           millis = Long.parseLong(sValue);
       }
       return new TimeValue(millis, TimeUnit.MILLISECONDS);
   }