public static String timestampToReadableString()

in hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java [113:145]


    public static String timestampToReadableString(long time) {
        Duration duration = Duration.ofMillis(time);
        long days = duration.toDays();
        long hours = duration.toHours();
        long minutes = duration.toMinutes();
        long seconds = duration.getSeconds();

        if (days > 0) {
            return String.format("%dd%dh%dm%ds",
                                 days,
                                 hours % 24,
                                 minutes % 60,
                                 seconds % 60);
        } else if (hours > 0) {
            return String.format("%dh%dm%ds",
                                 hours,
                                 minutes % 60,
                                 seconds % 60);
        } else if (minutes > 0) {
            return String.format("%dm%ds",
                                 minutes,
                                 seconds % 60);
        } else if (seconds > 0) {
            long ms = duration.toMillis() % 1000L;
            if (ms > 0L) {
                return String.format("%ds%dms", seconds, ms);
            } else {
                return String.format("%ds", seconds);
            }
        } else {
            return String.format("%dms", duration.toMillis());
        }
    }