OMS (v3.0.25)

oms3.util
Class Times

java.lang.Object
  extended by oms3.util.Times

public class Times
extends java.lang.Object

Author:
Olaf David

Field Summary
static int CALENDAR_YEAR
          Calendar year (Jan 1st - Dec 31st)
static long EPOCH_UNIX_ERA_DAY
          Value to add to the day number returned by this calendar to find the Julian Day number.
protected static long MILLISECS_PER_DAY
          Number of leap seconds per day expect on
1.
static long MILLISECS_PER_HOUR
          Number of milliseconds per hour, except when a leap second is inserted.
static 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.
static int SOLAR_YEAR
          Solar year (Dec 21st - Dec20th).
static int WATER_YEAR
          Water year (Oct 1st - Sept 31st)
 
Constructor Summary
Times()
           
 
Method Summary
static double deltaHours(int calUnit, int increments)
          This used to be 'deltim' in MMS.
static long diffDayPeriods(java.util.Calendar start, java.util.Calendar end)
          find the number of days from this date to the given end date.
static int getDayOfYear(java.util.Calendar cal, int type)
          Get the Day of the year in WATER, SOLAR, or CALENDAR year.
static long getJulianDay(java.util.Calendar cal)
           
static long getUnixDay(java.util.Calendar cal)
           
static boolean isLeapYear(int year)
          Check if a year is a leap year.
static void setSerialDate(java.util.Calendar cal, double serialDate)
          Set a calendar object to a serial date value.
static double toSerialDate(java.util.Calendar cal)
          Convert a calendar to a serial date value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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(java.util.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(java.util.Calendar cal)
Returns:
LOCAL Chronologists Julian day number each day starting from midnight LOCAL TIME.

diffDayPeriods

public static long diffDayPeriods(java.util.Calendar start,
                                  java.util.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(java.util.Calendar cal,
                               int type)
Get the Day of the year in WATER, SOLAR, or CALENDAR year.


toSerialDate

public static double toSerialDate(java.util.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(java.util.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.


OMS (v3.0.25)

Generated 2010-08-11 08:44:20 MDT, USDA-ARS-ASRU/CSU, 2150 Center Ave, Fort Collins, CO 80526, U.S.A.