code: public static StringBuilder durationConfigString(Duration duration) {
          Duration remainder = duration;
  
          long days = remainder.getStandardDays();
          remainder = remainder.minus(Duration.standardDays(days));
  
          long hours = remainder.getStandardHours();
          remainder = remainder.minus(Duration.standardHours(hours));
  
          long minutes = remainder.getStandardMinutes();
          remainder = remainder.minus(Duration.standardMinutes(minutes));
  
          long seconds = remainder.getStandardSeconds();
          remainder = remainder.minus(Duration.standardSeconds(seconds));
  
          if (!remainder.isEqual(Duration.ZERO))
              Logger.getLogger(ConfigSupport.class.getName()).log(Level.WARNING, "Duration is more precise than configuration will handle: {0}, dropping remainder: {1}", new Object[]{duration, remainder});
  
          StringBuilder result = new StringBuilder();
          if (days != 0) {
              if (result.length() != 0) result.append(' ');
              result.append(days).append('d');
          }
          if (hours != 0) {
              if (result.length() != 0) result.append(' ');
              result.append(hours).append('h');
          }
          if (minutes != 0) {
              if (result.length() != 0) result.append(' ');
              result.append(minutes).append('m');
          }
          if (result.length() == 0 || seconds != 0) {
              if (result.length() != 0) result.append(' ');
              result.append(seconds).append('s');
          }
  
          return result;
      }
docs: Convert duration to an representation accepted by Configuration parser.
  @param duration A duration.
  @return A StringBuilder with the string representation of the duration.