Package com.wombat.mama
Class MamaDateTime
- java.lang.Object
-
- com.wombat.mama.MamaDateTime
-
- All Implemented Interfaces:
java.lang.Comparable
public class MamaDateTime extends java.lang.Object implements java.lang.ComparableMamaDataTime Posix date/time representation.
-
-
Constructor Summary
Constructors Constructor Description MamaDateTime()MamaDateTime(MamaDateTime copy)MamaDateTime(MamaDateTime time, MamaDateTime date)MamaDateTime(java.lang.String str)MamaDateTime(java.lang.String str, MamaTimeZone tz)MamaDateTime(java.util.Calendar calendar)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMicroSeconds(long microSeconds)voidaddSeconds(double seconds)voidaddSeconds(long seconds)voidclear()voidclearDate()voidclearTime()intcompareTo(java.lang.Object obj)voidcopy(MamaDateTime copy)voidcopyDate(MamaDateTime src)voidcopyTime(MamaDateTime src)voiddestroy()static longdiffMicroseconds(MamaDateTime t1, MamaDateTime t0)static doublediffSeconds(MamaDateTime t1, MamaDateTime t0)static doublediffSecondsSameDay(MamaDateTime t1, MamaDateTime t0)booleanequals(java.lang.Object obj)java.lang.StringgetAsString()java.util.CalendargetCalendar()java.lang.StringgetDateAsString()longgetDay()MamaDayOfWeekgetDayOfWeek()longgetEpochTimeMicroseconds()Get the date and time as microseconds since the Epoch, (using the UTC timezone).longgetEpochTimeMilliseconds()doublegetEpochTimeSeconds()doublegetEpochTimeSecondsWithCheck()Get the date and time as seconds since the Epoch, (using the UTC timezone).longgetHour()longgetMicrosecond()longgetMinute()longgetMonth()longgetSecond()java.lang.StringgetTimeAsString()longgetYear()booleanhasDate()inthashCode()booleanhasTime()booleanisEmpty()voidset(int year, int month, int day, int hour, int minute, int second, long microsecond, MamaDateTimePrecision precision, MamaTimeZone tz)voidsetDate(int year, int month, int day)voidsetEpochTime(long secondsSinceEpoch, long microseconds)voidsetEpochTime(long secondsSinceEpoch, long microseconds, MamaDateTimePrecision precision)voidsetEpochTimeF64(double secondsSinceEpoch)voidsetEpochTimeMicroseconds(long microsecondsSinceEpoch)voidsetEpochTimeMilliseconds(long millisecondsSinceEpoch)voidsetTime(int hour, int minute, int second, long microsecond, MamaDateTimePrecision precision, MamaTimeZone tz)voidsetToMidnightToday(MamaTimeZone tz)voidsetToNow()voidsetWithHints(long secondsSinceEpoch, long microseconds, MamaDateTimePrecision precision, MamaDateTimeHints hints)java.lang.StringtoString()
-
-
-
Constructor Detail
-
MamaDateTime
public MamaDateTime()
-
MamaDateTime
public MamaDateTime(MamaDateTime copy)
-
MamaDateTime
public MamaDateTime(MamaDateTime time, MamaDateTime date)
-
MamaDateTime
public MamaDateTime(java.util.Calendar calendar)
-
MamaDateTime
public MamaDateTime(java.lang.String str)
-
MamaDateTime
public MamaDateTime(java.lang.String str, MamaTimeZone tz)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(java.lang.Object obj)
- Specified by:
compareToin interfacejava.lang.Comparable
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
isEmpty
public boolean isEmpty()
-
setEpochTime
public void setEpochTime(long secondsSinceEpoch, long microseconds, MamaDateTimePrecision precision)
-
setEpochTime
public void setEpochTime(long secondsSinceEpoch, long microseconds)
-
setEpochTimeF64
public void setEpochTimeF64(double secondsSinceEpoch)
-
setEpochTimeMilliseconds
public void setEpochTimeMilliseconds(long millisecondsSinceEpoch)
-
setEpochTimeMicroseconds
public void setEpochTimeMicroseconds(long microsecondsSinceEpoch)
-
setWithHints
public void setWithHints(long secondsSinceEpoch, long microseconds, MamaDateTimePrecision precision, MamaDateTimeHints hints)
-
setToNow
public void setToNow()
-
setToMidnightToday
public void setToMidnightToday(MamaTimeZone tz)
-
set
public void set(int year, int month, int day, int hour, int minute, int second, long microsecond, MamaDateTimePrecision precision, MamaTimeZone tz)
-
setTime
public void setTime(int hour, int minute, int second, long microsecond, MamaDateTimePrecision precision, MamaTimeZone tz)
-
setDate
public void setDate(int year, int month, int day)
-
copyTime
public void copyTime(MamaDateTime src)
-
copyDate
public void copyDate(MamaDateTime src)
-
clear
public void clear()
-
clearTime
public void clearTime()
-
clearDate
public void clearDate()
-
hasDate
public boolean hasDate()
-
hasTime
public boolean hasTime()
-
addSeconds
public void addSeconds(double seconds)
-
addSeconds
public void addSeconds(long seconds)
-
addMicroSeconds
public void addMicroSeconds(long microSeconds)
-
getEpochTimeMicroseconds
public long getEpochTimeMicroseconds()
Get the date and time as microseconds since the Epoch, (using the UTC timezone).- Returns:
- The number of microseconds since the Epoch.
- Throws:
com.wombat.mama- MamaException thrown if the underlying JNI object has been destroyed.com.wombat.common.WombatException- for other general MAMA errors.
-
getEpochTimeMilliseconds
public long getEpochTimeMilliseconds()
-
getEpochTimeSeconds
public double getEpochTimeSeconds()
-
getEpochTimeSecondsWithCheck
public double getEpochTimeSecondsWithCheck()
Get the date and time as seconds since the Epoch, (using the UTC timezone). If no date value is contained in the dateTime then it will be set to today's date and the calculation made.- Returns:
- The number of seconds, (including partial seconds), since the Epoch.
- Throws:
com.wombat.mama- MamaException thrown if the underlying JNI object has been destroyed.com.wombat.common.WombatException- for other general MAMA errors.
-
getAsString
public java.lang.String getAsString()
-
getTimeAsString
public java.lang.String getTimeAsString()
-
getDateAsString
public java.lang.String getDateAsString()
-
getYear
public long getYear()
-
getMonth
public long getMonth()
-
getDay
public long getDay()
-
getHour
public long getHour()
-
getMinute
public long getMinute()
-
getSecond
public long getSecond()
-
getMicrosecond
public long getMicrosecond()
-
getDayOfWeek
public MamaDayOfWeek getDayOfWeek()
-
diffSeconds
public static double diffSeconds(MamaDateTime t1, MamaDateTime t0)
-
diffSecondsSameDay
public static double diffSecondsSameDay(MamaDateTime t1, MamaDateTime t0)
-
diffMicroseconds
public static long diffMicroseconds(MamaDateTime t1, MamaDateTime t0)
-
getCalendar
public java.util.Calendar getCalendar()
-
destroy
public void destroy()
-
copy
public void copy(MamaDateTime copy)
-
-