From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: YatopiaMC Date: Fri, 23 Oct 2020 09:20:01 -0700 Subject: [PATCH] Time Utilities Original code by YatopiaMC, licensed under MIT You can find the original code on https://github.com/YatopiaMC/Yatopia diff --git a/src/main/java/org/yatopiamc/yatopia/server/util/TimeUtils.java b/src/main/java/org/yatopiamc/yatopia/server/util/TimeUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..bb023bcb4b1e1ab5261c83358ce0951cc35ba16d --- /dev/null +++ b/src/main/java/org/yatopiamc/yatopia/server/util/TimeUtils.java @@ -0,0 +1,27 @@ +package org.yatopiamc.yatopia.server.util; + +import java.util.concurrent.TimeUnit; + +public class TimeUtils { + + public static String getFriendlyName(TimeUnit unit) { + switch (unit) { + case NANOSECONDS: + return "ns"; + case MILLISECONDS: + return "ms"; + case MICROSECONDS: + return "micros"; + case SECONDS: + return "s"; + case MINUTES: + return "m"; + case DAYS: + return "d"; + case HOURS: + return "h"; + default: + throw new AssertionError(); + } + } +} \ No newline at end of file