Package org.openstreetmap.josm.data.gpx
Class GpxTimeOffset
- java.lang.Object
-
- org.openstreetmap.josm.data.gpx.GpxTimeOffset
-
public final class GpxTimeOffset extends java.lang.Object
Time offset of GPX correlation.- Since:
- 14205 (extracted from
CorrelateGpxWithImages)
-
-
Field Summary
Fields Modifier and Type Field Description private longmillisecondsstatic GpxTimeOffsetZEROThe time offset 0.
-
Constructor Summary
Constructors Modifier Constructor Description privateGpxTimeOffset(long milliseconds)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.StringformatOffset()Formats time offset.intgetDayOffset()Returns the day difference.longgetMilliseconds()Get time offset in milliseconds.longgetSeconds()Get time offset in seconds.inthashCode()static GpxTimeOffsetmilliseconds(long milliseconds)Constructs a newGpxTimeOffsetfrom milliseconds.static GpxTimeOffsetparseOffset(java.lang.String offset)Parses time offset.static GpxTimeOffsetseconds(long seconds)Constructs a newGpxTimeOffsetfrom seconds.Pair<GpxTimezone,GpxTimeOffset>splitOutTimezone()Split out timezone and offset.GpxTimeOffsetwithoutDayOffset()Returns offset without day difference.
-
-
-
Field Detail
-
ZERO
public static final GpxTimeOffset ZERO
The time offset 0.
-
milliseconds
private final long milliseconds
-
-
Constructor Detail
-
GpxTimeOffset
private GpxTimeOffset(long milliseconds)
-
-
Method Detail
-
milliseconds
public static GpxTimeOffset milliseconds(long milliseconds)
Constructs a newGpxTimeOffsetfrom milliseconds.- Parameters:
milliseconds- time offset in milliseconds.- Returns:
- new
GpxTimeOffset
-
seconds
public static GpxTimeOffset seconds(long seconds)
Constructs a newGpxTimeOffsetfrom seconds.- Parameters:
seconds- time offset in seconds.- Returns:
- new
GpxTimeOffset
-
getMilliseconds
public long getMilliseconds()
Get time offset in milliseconds.- Returns:
- time offset in milliseconds
-
getSeconds
public long getSeconds()
Get time offset in seconds.- Returns:
- time offset in seconds
-
formatOffset
public java.lang.String formatOffset()
Formats time offset.- Returns:
- formatted time offset. Format: decimal number
-
parseOffset
public static GpxTimeOffset parseOffset(java.lang.String offset) throws java.text.ParseException
Parses time offset.- Parameters:
offset- time offset. Format: decimal number- Returns:
- time offset
- Throws:
java.text.ParseException- if time offset can't be parsed
-
getDayOffset
public int getDayOffset()
Returns the day difference.- Returns:
- the day difference
-
withoutDayOffset
public GpxTimeOffset withoutDayOffset()
Returns offset without day difference.- Returns:
- offset without day difference
-
splitOutTimezone
public Pair<GpxTimezone,GpxTimeOffset> splitOutTimezone()
Split out timezone and offset.- Returns:
- pair of timezone and offset
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-