static String toRichTimeDuration(long duration) {
    long days = TimeUnit.SECONDS.toDays(duration);
    duration -= TimeUnit.DAYS.toSeconds(days);
    long hours = TimeUnit.SECONDS.toHours(duration);
    duration -= TimeUnit.HOURS.toSeconds(hours);
    long minutes = TimeUnit.SECONDS.toMinutes(duration);
    duration -= TimeUnit.MINUTES.toSeconds(minutes);
    long seconds = TimeUnit.SECONDS.toSeconds(duration);

    StringBuilder builder = new StringBuilder();
    if (days != 0) {
      builder.append(days + " days ");
    }
    if (days != 0 || hours != 0) {
      builder.append(hours + " hours ");
    }
    if (days != 0 || hours != 0 || minutes != 0) {
      builder.append(minutes + " minutes ");
    }
    builder.append(seconds + " seconds");
    return builder.toString();
  }
@Test
  void testRichDuration() {
    String richDuration = JobManager.toRichTimeDuration(18);
    assertEquals("18 seconds", richDuration);

    richDuration = JobManager.toRichTimeDuration(120);
    assertEquals("2 minutes 0 seconds", richDuration);

    richDuration = JobManager.toRichTimeDuration(60 * 60 + 1);
    assertEquals("1 hours 0 minutes 1 seconds", richDuration);

    richDuration = JobManager.toRichTimeDuration(60 * 60 + 60 + 1);
    assertEquals("1 hours 1 minutes 1 seconds", richDuration);

    richDuration = JobManager.toRichTimeDuration(24 * 60 * 60 + 60 + 1);
    assertEquals("1 days 0 hours 1 minutes 1 seconds", richDuration);
  }