Package oms3.util

Class Times


  • public class Times
    extends Object
    Author:
    Olaf David
    • Field Detail

      • SOLAR_YEAR

        public static final int SOLAR_YEAR
        Solar year (Dec 21st - Dec20th).
        See Also:
        Constant Field Values
      • WATER_YEAR

        public static final int WATER_YEAR
        Water year (Oct 1st - Sept 31st)
        See Also:
        Constant Field Values
      • CALENDAR_YEAR

        public static final int CALENDAR_YEAR
        Calendar year (Jan 1st - Dec 31st)
        See Also:
        Constant Field Values
      • MILLISECS_PER_MINUTE

        public static final long MILLISECS_PER_MINUTE
        All minutes have this many milliseconds except the last minute of the day on a day defined with a leap second.
        See Also:
        Constant Field Values
      • MILLISECS_PER_HOUR

        public static final long MILLISECS_PER_HOUR
        Number of milliseconds per hour, except when a leap second is inserted.
        See Also:
        Constant Field Values
      • MILLISECS_PER_DAY

        protected static final long MILLISECS_PER_DAY
        Number of leap seconds per day expect on
        1. days when a leap second has been inserted, e.g. 1999 JAN 1.
        2. Daylight-savings "spring forward" or "fall back" days.
        See Also:
        Constant Field Values
      • EPOCH_UNIX_ERA_DAY

        public static final long EPOCH_UNIX_ERA_DAY
        Value to add to the day number returned by this calendar to find the Julian Day number. This is the Julian Day number for 1/1/1970. Note: Since the unix Day number is the same from local midnight to local midnight adding JULIAN_DAY_OFFSET to that value results in the chronologist, historians, or calenderists Julian Day number.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Times

        public Times()
    • Method Detail

      • getUnixDay

        public static long getUnixDay​(Calendar cal)
        Parameters:
        cal -
        Returns:
        Day number where day 0 is 1/1/1970, as per the Unix/Java date/time epoch.
      • getJulianDay

        public static long getJulianDay​(Calendar cal)
        Returns:
        LOCAL Chronologists Julian day number each day starting from midnight LOCAL TIME.
      • diffDayPeriods

        public static long diffDayPeriods​(Calendar start,
                                          Calendar end)
        find the number of days from this date to the given end date. later end dates result in positive values. Note this is not the same as subtracting day numbers. Just after midnight subtracted from just before midnight is 0 days for this method while subtracting day numbers would yields 1 day.
        Parameters:
        end - - any Calendar representing the moment of time at the end of the interval for calculation.
      • isLeapYear

        public static boolean isLeapYear​(int year)
        Check if a year is a leap year.
        Parameters:
        year - the calendar year to check
        Returns:
        true is the given year is a leap year.
      • getDayOfYear

        public static int getDayOfYear​(Calendar cal,
                                       int type)
        Get the Day of the year in WATER, SOLAR, or CALENDAR year.
      • toSerialDate

        public static double toSerialDate​(Calendar cal)
        Convert a calendar to a serial date value. a serial date is the number of days since Jan 01 1900 plus a fractional.
        Parameters:
        cal - the calendar object
        Returns:
        the serial date
      • setSerialDate

        public static void setSerialDate​(Calendar cal,
                                         double serialDate)
        Set a calendar object to a serial date value.
        Parameters:
        cal - the calendar to set the value
        serialDate - the serial date to apply
      • deltaHours

        public static double deltaHours​(int calUnit,
                                        int increments)
        This used to be 'deltim' in MMS.