Class TimeTools

java.lang.Object
com.palmergames.util.TimeTools

public class TimeTools extends Object
Author:
dumptruckman
  • Constructor Details

    • TimeTools

      public TimeTools()
  • Method Details

    • secondsFromDhms

      public static long secondsFromDhms(String dhms)
      This will parse a time string such as 2d30m to an equivalent amount of seconds.
      Parameters:
      dhms - The time string
      Returns:
      The amount of seconds
    • getMillis

      public static long getMillis(String dhms)
    • getSeconds

      public static long getSeconds(String dhms)
    • getTicks

      public static long getTicks(String dhms)
    • convertToTicks

      public static long convertToTicks(long t)
      Converts Seconds to Ticks
      Parameters:
      t - - Unix time
      Returns:
      ticks
    • convertToShortTicks

      public static int convertToShortTicks(double timeSeconds)
      Converts Seconds to 'Short' Ticks These ticks are only relevant to the 'Short' Timer Task Rounds half up
      Parameters:
      timeSeconds - number of seconds to convert.
      Returns:
      ticks
    • getHours

      public static int getHours(long milliSeconds)
    • getDays

      public static int getDays(long milliSeconds)
    • getTimeInMillisXSecondsAgo

      public static long getTimeInMillisXSecondsAgo(int seconds)
    • getTimeInMillisXMinutesAgo

      public static long getTimeInMillisXMinutesAgo(int minutes)
    • getTimeInMillisXHoursAgo

      public static long getTimeInMillisXHoursAgo(int hours)
    • getTimeInMillisXDaysAgo

      public static long getTimeInMillisXDaysAgo(int days)