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 long
milliseconds
static GpxTimeOffset
ZERO
The time offset 0.
-
Constructor Summary
Constructors Modifier Constructor Description private
GpxTimeOffset(long milliseconds)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.String
formatOffset()
Formats time offset.int
getDayOffset()
Returns the day difference.long
getMilliseconds()
Get time offset in milliseconds.long
getSeconds()
Get time offset in seconds.int
hashCode()
static GpxTimeOffset
milliseconds(long milliseconds)
Constructs a newGpxTimeOffset
from milliseconds.static GpxTimeOffset
parseOffset(java.lang.String offset)
Parses time offset.static GpxTimeOffset
seconds(long seconds)
Constructs a newGpxTimeOffset
from seconds.Pair<GpxTimezone,GpxTimeOffset>
splitOutTimezone()
Split out timezone and offset.GpxTimeOffset
withoutDayOffset()
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 newGpxTimeOffset
from milliseconds.- Parameters:
milliseconds
- time offset in milliseconds.- Returns:
- new
GpxTimeOffset
-
seconds
public static GpxTimeOffset seconds(long seconds)
Constructs a newGpxTimeOffset
from 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-