org.fudgemsg.types
Class FudgeTime

java.lang.Object
  extended by org.fudgemsg.types.FudgeTime
All Implemented Interfaces:
TimeProvider

public class FudgeTime
extends Object
implements TimeProvider

Dummy class for holding a time value on its own at varying precisions. See DateTime encoding for more details.


Constructor Summary
  FudgeTime(Calendar time)
          Creates a new FudgeTime with the time from a Calendar object.
protected FudgeTime(DateTimeAccuracy accuracy, Instant instant)
          Creates a new Fudge time representation.
  FudgeTime(DateTimeAccuracy accuracy, InstantProvider instantProvider)
          Creates a new Fudge time representation.
  FudgeTime(DateTimeAccuracy accuracy, int timezoneOffset, int seconds, int nanos)
          Creates a new FudgeTime.
protected FudgeTime(DateTimeAccuracy accuracy, int timezoneOffset, LocalTime localTime)
          Creates a new Fudge time representation.
protected FudgeTime(DateTimeAccuracy accuracy, LocalTime localTime)
          Creates a new Fudge time representation.
  FudgeTime(DateTimeAccuracy accuracy, OffsetTime offsetTime)
          Creates a new Fudge time representation.
  FudgeTime(DateTimeAccuracy accuracy, TimeProvider timeProvider)
          Creates a new Fudge time representation.
  FudgeTime(InstantProvider instantProvider)
          Creates a new Fudge time representation.
  FudgeTime(OffsetTime offsetTime)
          Creates a new Fudge time representation.
  FudgeTime(TimeProvider timeProvider)
          Creates a new Fudge time representation.
 
Method Summary
 boolean equals(Object o)
          
 DateTimeAccuracy getAccuracy()
           
 int getHour()
          Returns the hour of the day.
 int getMicros()
          Returns the microseconds within the second.
 int getMillis()
          Returns the milliseconds within the second.
 int getMinute()
          Returns the minute within the hour.
 int getNanos()
          Returns the number of nanoseconds within the second.
protected  ZoneOffset getOffset()
          Returns the timezone offset as a ZoneOffset object.
 int getSeconds()
          Returns the second within the minute.
 int getSecondsSinceMidnight()
          Returns the number of seconds since midnight.
 int getTimezoneOffset()
          Returns the timezone offset as held.
 int hashCode()
          
 boolean hasTimezoneOffset()
           
 LocalTime toLocalTime()
          Returns a LocalTime representation of the time.
 OffsetTime toOffsetTime()
          Returns a OffsetTime representation of the time.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FudgeTime

public FudgeTime(DateTimeAccuracy accuracy,
                 int timezoneOffset,
                 int seconds,
                 int nanos)
Creates a new FudgeTime.

Parameters:
accuracy - resolution of the time
timezoneOffset - timezoneOffset (15 minute intervals)
seconds - seconds since midnight
nanos - nanoseconds within the second

FudgeTime

protected FudgeTime(DateTimeAccuracy accuracy,
                    int timezoneOffset,
                    LocalTime localTime)
Creates a new Fudge time representation.

Parameters:
accuracy - granularity of the representation
timezoneOffset - timezone offset in 15 minute intervals from UTC
localTime - the time

FudgeTime

protected FudgeTime(DateTimeAccuracy accuracy,
                    LocalTime localTime)
Creates a new Fudge time representation.

Parameters:
accuracy - granularity of the representation
localTime - the time

FudgeTime

protected FudgeTime(DateTimeAccuracy accuracy,
                    Instant instant)
Creates a new Fudge time representation.

Parameters:
accuracy - granularity of the representation
instant - time instant - the corresponding time at UTC will be used

FudgeTime

public FudgeTime(OffsetTime offsetTime)
Creates a new Fudge time representation.

Parameters:
offsetTime - time

FudgeTime

public FudgeTime(DateTimeAccuracy accuracy,
                 OffsetTime offsetTime)
Creates a new Fudge time representation.

Parameters:
accuracy - granularity of the representation
offsetTime - time

FudgeTime

public FudgeTime(InstantProvider instantProvider)
Creates a new Fudge time representation.

Parameters:
instantProvider - provides a time instant - the corresponding time at UTC will be used

FudgeTime

public FudgeTime(DateTimeAccuracy accuracy,
                 InstantProvider instantProvider)
Creates a new Fudge time representation.

Parameters:
accuracy - granularity of the representation
instantProvider - provides a time instant - the corresponding time at UTC will be used

FudgeTime

public FudgeTime(TimeProvider timeProvider)
Creates a new Fudge time representation.

Parameters:
timeProvider - provides the time

FudgeTime

public FudgeTime(DateTimeAccuracy accuracy,
                 TimeProvider timeProvider)
Creates a new Fudge time representation.

Parameters:
accuracy - granularity of the representation
timeProvider - provides the time

FudgeTime

public FudgeTime(Calendar time)
Creates a new FudgeTime with the time from a Calendar object.

Parameters:
time - the Calendar to copy the time from
Method Detail

getAccuracy

public DateTimeAccuracy getAccuracy()
Returns:
the resolution

hasTimezoneOffset

public boolean hasTimezoneOffset()
Returns:
true if the FudgeTime has a timezone offset, false otherwise

getTimezoneOffset

public int getTimezoneOffset()
Returns the timezone offset as held. See also getOffset().

Returns:
the timezone offset (15 minute intervals) or 0 if there is no offset

toLocalTime

public LocalTime toLocalTime()
Returns a LocalTime representation of the time.

Specified by:
toLocalTime in interface TimeProvider
Returns:
the time

getOffset

protected ZoneOffset getOffset()
Returns the timezone offset as a ZoneOffset object. See also getTimezoneOffset().

Returns:
the timezone offset

toOffsetTime

public OffsetTime toOffsetTime()
Returns a OffsetTime representation of the time.

Returns:
the time

getSecondsSinceMidnight

public int getSecondsSinceMidnight()
Returns the number of seconds since midnight.

Returns:
seconds

getNanos

public int getNanos()
Returns the number of nanoseconds within the second.

Returns:
nanoseconds

getHour

public int getHour()
Returns the hour of the day.

Returns:
hour

getMinute

public int getMinute()
Returns the minute within the hour.

Returns:
minutes

getSeconds

public int getSeconds()
Returns the second within the minute.

Returns:
seconds

getMillis

public int getMillis()
Returns the milliseconds within the second.

Returns:
milliseconds

getMicros

public int getMicros()
Returns the microseconds within the second.

Returns:
microseconds

toString

public String toString()

Overrides:
toString in class Object

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


Copyright 2009-Present by OpenGamma Inc. and individual contributors
Released under the Apache License, Version 2.0