public class PackedLocalTime extends Object
The bytes are packed into the int as: First byte: hourOfDay next byte: minuteOfHour last two bytes (short): millisecond of minute
Storing the millisecond of minute in an short requires that we treat the short as if it were unsigned. Unfortunately, Neither Java nor Guava provide unsigned short support so we use char, which is a 16-bit unsigned int to store values of up to 60,000 milliseconds (60 secs * 1000)
Constructor | Description |
---|---|
PackedLocalTime() |
Modifier and Type | Method | Description |
---|---|---|
static boolean |
AM(int packedTime) |
Returns true if the time is in the AM or "before noon".
|
static LocalTime |
asLocalTime(int time) |
|
static byte |
getHour(int time) |
|
static int |
getMillisecondOfDay(int packedLocalTime) |
|
static char |
getMillisecondOfMinute(int time) |
|
static int |
getMilliseconds(int time) |
|
static byte |
getMinute(int time) |
|
static int |
getMinuteOfDay(int packedLocalTime) |
|
static int |
getNano(int time) |
|
static byte |
getSecond(int packedLocalTime) |
|
static int |
getSecondOfDay(int packedLocalTime) |
|
static int |
hoursUntil(int packedTimeEnd,
int packedTimeStart) |
|
static boolean |
isAfter(int packedTime,
int otherPackedTime) |
|
static boolean |
isBefore(int packedTime,
int otherPackedTime) |
|
static boolean |
isEqualTo(int packedTime,
int otherPackedTime) |
|
static boolean |
isMidnight(int packedTime) |
|
static boolean |
isNoon(int packedTime) |
|
static boolean |
isOnOrAfter(int packedTime,
int otherPackedTime) |
|
static boolean |
isOnOrBefore(int packedTime,
int otherPackedTime) |
|
static int |
minusHours(int hoursToSubtract,
int packedTime) |
|
static int |
minusMilliseconds(int millisToSubtract,
int packedTime) |
|
static int |
minusMinutes(int minutesToSubtract,
int packedTime) |
|
static int |
minusSeconds(int secondsToSubtract,
int packedTime) |
|
static int |
minutesUntil(int packedTimeEnd,
int packedTimeStart) |
|
static int |
of(int hour,
int minute) |
|
static int |
of(int hour,
int minute,
int second) |
|
static int |
of(int hour,
int minute,
int second,
int millis) |
|
static int |
pack(LocalTime time) |
|
static int |
plusHours(int hoursToAdd,
int packedTime) |
|
static int |
plusMilliseconds(int msToAdd,
int packedTime) |
|
static int |
plusMinutes(int minutesToAdd,
int packedTime) |
|
static int |
plusSeconds(int secondsToAdd,
int packedTime) |
|
static boolean |
PM(int packedTime) |
Returns true if the time is in the PM or "after noon".
|
static int |
secondsUntil(int packedTimeEnd,
int packedTimeStart) |
|
static long |
toNanoOfDay(int time) |
|
static String |
toShortTimeString(int time) |
|
static int |
truncatedTo(TemporalUnit unit,
int packedTime) |
|
static int |
withHour(int hour,
int packedTime) |
|
static int |
withMillisecond(int milliseconds,
int packedTime) |
|
static int |
withMinute(int minute,
int packedTime) |
|
static int |
withSecond(int second,
int packedTime) |
public static byte getHour(int time)
public static int of(int hour, int minute)
public static int of(int hour, int minute, int second)
public static int of(int hour, int minute, int second, int millis)
public static int truncatedTo(TemporalUnit unit, int packedTime)
public static int plusHours(int hoursToAdd, int packedTime)
public static int plusMinutes(int minutesToAdd, int packedTime)
public static int plusSeconds(int secondsToAdd, int packedTime)
public static int plusMilliseconds(int msToAdd, int packedTime)
public static int minusHours(int hoursToSubtract, int packedTime)
public static int minusMinutes(int minutesToSubtract, int packedTime)
public static int minusSeconds(int secondsToSubtract, int packedTime)
public static int minusMilliseconds(int millisToSubtract, int packedTime)
public static int withHour(int hour, int packedTime)
public static int withMinute(int minute, int packedTime)
public static int withSecond(int second, int packedTime)
public static int withMillisecond(int milliseconds, int packedTime)
public static char getMillisecondOfMinute(int time)
public static int getNano(int time)
public static int getMilliseconds(int time)
public static long toNanoOfDay(int time)
public static LocalTime asLocalTime(int time)
public static byte getMinute(int time)
public static int pack(LocalTime time)
public static byte getSecond(int packedLocalTime)
public static int getMinuteOfDay(int packedLocalTime)
public static int getSecondOfDay(int packedLocalTime)
public static int getMillisecondOfDay(int packedLocalTime)
public static String toShortTimeString(int time)
public static boolean isMidnight(int packedTime)
public static boolean isNoon(int packedTime)
public static boolean isAfter(int packedTime, int otherPackedTime)
public static boolean isOnOrAfter(int packedTime, int otherPackedTime)
public static boolean isBefore(int packedTime, int otherPackedTime)
public static boolean isOnOrBefore(int packedTime, int otherPackedTime)
public static boolean isEqualTo(int packedTime, int otherPackedTime)
public static boolean AM(int packedTime)
public static boolean PM(int packedTime)
public static int hoursUntil(int packedTimeEnd, int packedTimeStart)
public static int minutesUntil(int packedTimeEnd, int packedTimeStart)
public static int secondsUntil(int packedTimeEnd, int packedTimeStart)
Copyright © 2022. All rights reserved.