public static TimeUnit toTimeUnit(String t) {
    switch (t) {
      case "h":
      case "hour":
        return TimeUnit.HOURS;
      case "m":
      case "minute":
        return TimeUnit.MINUTES;
      case "s":
      case "second":
        return TimeUnit.SECONDS;
      case "ms":
      case "millisecond":
        return TimeUnit.MILLISECONDS;
      case "u":
      case "microsecond":
        return TimeUnit.MICROSECONDS;
      case "n":
      case "nanosecond":
        return TimeUnit.NANOSECONDS;
      default:
        throw new IllegalArgumentException("time precision must be one of: h,m,s,ms,u,n");
    }
  }
convert duration string to millisecond, microsecond or nanosecond.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/DateTimeUtils.java