From bf8c244fcea3f2bfa3ff8429a33054b8672985f2 Mon Sep 17 00:00:00 2001 From: garbagemule Date: Tue, 25 Feb 2014 02:11:43 +0100 Subject: [PATCH] Add utility class for timer package. --- .../MobArena/util/timer/Common.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/com/garbagemule/MobArena/util/timer/Common.java diff --git a/src/com/garbagemule/MobArena/util/timer/Common.java b/src/com/garbagemule/MobArena/util/timer/Common.java new file mode 100644 index 0000000..e7ef62a --- /dev/null +++ b/src/com/garbagemule/MobArena/util/timer/Common.java @@ -0,0 +1,23 @@ +package com.garbagemule.MobArena.util.timer; + +public class Common { + /** + * Convert seconds to ticks. + * + * @param seconds value to convert + * @return the value converted to ticks + */ + public static long toTicks(int seconds) { + return seconds * 20l; + } + + /** + * Convert ticks to seconds. + * + * @param ticks value to convert + * @return the value converted to seconds + */ + public static int toSeconds(long ticks) { + return (int) (ticks / 20l); + } +}