code: public static long timeInMsOrOneIfResultIsZero(long time, TimeUnit timeUnit) {
          long timeInMillis = timeUnit.toMillis(time);
          if (time > 0 && timeInMillis == 0) {
              timeInMillis = 1;
          }
  
          return timeInMillis;
      }
docs: Convert time to milliseconds based on the given time unit.
  If conversion result is 0 and {@code time} was > 0, then 1 is returned.
  
  @param time The input time
  @param timeUnit The time unit to base the conversion on
  
  @throws NullPointerException if time unit is <code>null</code>
  @return The millisecond representation of the input time