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.Comparable
MamaDataTime 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 void
addMicroSeconds(long microSeconds)
void
addSeconds(double seconds)
void
addSeconds(long seconds)
void
clear()
void
clearDate()
void
clearTime()
int
compareTo(java.lang.Object obj)
void
copy(MamaDateTime copy)
void
copyDate(MamaDateTime src)
void
copyTime(MamaDateTime src)
void
destroy()
static long
diffMicroseconds(MamaDateTime t1, MamaDateTime t0)
static double
diffSeconds(MamaDateTime t1, MamaDateTime t0)
static double
diffSecondsSameDay(MamaDateTime t1, MamaDateTime t0)
boolean
equals(java.lang.Object obj)
java.lang.String
getAsString()
java.util.Calendar
getCalendar()
java.lang.String
getDateAsString()
long
getDay()
MamaDayOfWeek
getDayOfWeek()
long
getEpochTimeMicroseconds()
Get the date and time as microseconds since the Epoch, (using the UTC timezone).long
getEpochTimeMilliseconds()
double
getEpochTimeSeconds()
double
getEpochTimeSecondsWithCheck()
Get the date and time as seconds since the Epoch, (using the UTC timezone).long
getHour()
long
getMicrosecond()
long
getMinute()
long
getMonth()
long
getSecond()
java.lang.String
getTimeAsString()
long
getYear()
boolean
hasDate()
int
hashCode()
boolean
hasTime()
boolean
isEmpty()
void
set(int year, int month, int day, int hour, int minute, int second, long microsecond, MamaDateTimePrecision precision, MamaTimeZone tz)
void
setDate(int year, int month, int day)
void
setEpochTime(long secondsSinceEpoch, long microseconds)
void
setEpochTime(long secondsSinceEpoch, long microseconds, MamaDateTimePrecision precision)
void
setEpochTimeF64(double secondsSinceEpoch)
void
setEpochTimeMicroseconds(long microsecondsSinceEpoch)
void
setEpochTimeMilliseconds(long millisecondsSinceEpoch)
void
setTime(int hour, int minute, int second, long microsecond, MamaDateTimePrecision precision, MamaTimeZone tz)
void
setToMidnightToday(MamaTimeZone tz)
void
setToNow()
void
setWithHints(long secondsSinceEpoch, long microseconds, MamaDateTimePrecision precision, MamaDateTimeHints hints)
java.lang.String
toString()
-
-
-
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:
toString
in classjava.lang.Object
-
compareTo
public int compareTo(java.lang.Object obj)
- Specified by:
compareTo
in interfacejava.lang.Comparable
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in 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)
-
-