Documentation of 'com.mhuss.AstroLib.TimeOps' Java class
TimeOps
com.mhuss.AstroLib

Class TimeOps



  • public class TimeOps
    extends java.lang.Object
    TimeOps contains miscellaneous time-related functions.
    These are not in DateOps because they cause a circular dependancy between DateOps and AstroDate
    • Constructor Summary

      Constructors 
      Constructor and Description
      TimeOps() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static int dstOffset()
      Calculate the current Daylight Time offset.
      static int dstOffset(java.util.Calendar cal)
      Calculate the current Daylight Time offset ( 0 or -1 ).
      static double dstOffsetInDays()
      Calculate the current Daylight Time offset in fractional days.
      static double dstOffsetInDays(java.util.Calendar cal)
      Calculate the current Daylight Time offset in fractional days.
      static java.lang.String formatTime(double t)
      Format a time as a String using the format HH:MM.
      static int tzOffset()
      Determine the absolute time zone offset from UTC in hours (-12 to +12) using the local timezone.
      static int tzOffset(java.util.Calendar cal)
      Determine the absolute time zone offset from UTC in hours (-12 to +12) for the spec'd Calendar.
      static double tzOffsetInDays()
      Determine the absolute time zone offset from UTC in fractional days (-0.5 to +0.5).
      static double tzOffsetInDays(java.util.Calendar cal)
      Determine the absolute time zone offset from UTC in fractional days (-0.5 to +0.5).
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TimeOps

        public TimeOps()
    • Method Detail

      • dstOffset

        public static int dstOffset(java.util.Calendar cal)
        Calculate the current Daylight Time offset ( 0 or -1 ).
        Add the result of this function to the current time to adjust.
        Parameters:
        cal - A java.util.Calendar object which is used to get the DST_OFFSET from (e.g., java.util.GregorianCalendar)
        Returns:
        DST_OFFSET in hours if Daylight time is in effect, 0 otherwise.
      • dstOffset

        public static int dstOffset()
        Calculate the current Daylight Time offset.
        Add the result of this function to the current time to adjust.
        This function uses a GregorianCalendar object.
        Returns:
        DST_OFFSET in hours if Daylight time is in effect, 0 otherwise.
      • dstOffsetInDays

        public static double dstOffsetInDays(java.util.Calendar cal)
        Calculate the current Daylight Time offset in fractional days.
        Add the result of this function to the current time to adjust.
        Parameters:
        cal - A java.util.Calendar object which is used to get the DST_OFFSET
        Returns:
        DST_OFFSET in days if Daylight time is in effect, 0 otherwise.
      • dstOffsetInDays

        public static double dstOffsetInDays()
        Calculate the current Daylight Time offset in fractional days.
        Add the result of this function to the current time to adjust.
        This function uses a GregorianCalendar object.
        Returns:
        DST_OFFSET in days if Daylight time is in effect, 0 otherwise.
      • tzOffset

        public static int tzOffset(java.util.Calendar cal)
        Determine the absolute time zone offset from UTC in hours (-12 to +12) for the spec'd Calendar.
        Parameters:
        cal - The Calendar to use
        Returns:
        The offset in hours
      • tzOffset

        public static int tzOffset()
        Determine the absolute time zone offset from UTC in hours (-12 to +12) using the local timezone.
        Returns:
        The offset in hours
      • tzOffsetInDays

        public static double tzOffsetInDays(java.util.Calendar cal)
        Determine the absolute time zone offset from UTC in fractional days (-0.5 to +0.5).
        Parameters:
        cal - The Calendar to use
        Returns:
        The offset in decimal day
      • tzOffsetInDays

        public static double tzOffsetInDays()
        Determine the absolute time zone offset from UTC in fractional days (-0.5 to +0.5).
        Returns:
        The offset in decimal day
      • formatTime

        public static java.lang.String formatTime(double t)
        Format a time as a String using the format HH:MM.
        The returned string will be "--:--" if the time is INVALID.
        Parameters:
        t - The time to format in days
        Returns:
        The formatted String

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.