public final class TimeUtils
extends java.lang.Object
Understanding Unix vs NTFS timestamps:
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isUnixTime(java.nio.file.attribute.FileTime time)
Tests whether a FileTime can be safely represented in the standard UNIX time.
|
static boolean |
isUnixTime(long seconds)
Tests whether a given number of seconds (since Epoch) can be safely represented in the standard UNIX time.
|
static java.util.Date |
ntfsTimeToDate(long ntfsTime)
Deprecated.
|
static java.nio.file.attribute.FileTime |
ntfsTimeToFileTime(long ntfsTime)
Deprecated.
|
static java.util.Date |
toDate(java.nio.file.attribute.FileTime fileTime)
Deprecated.
|
static java.nio.file.attribute.FileTime |
toFileTime(java.util.Date date)
Deprecated.
|
static long |
toNtfsTime(java.util.Date date)
Deprecated.
|
static long |
toNtfsTime(java.nio.file.attribute.FileTime fileTime)
Deprecated.
|
static long |
toNtfsTime(long javaTime)
Converts Java time (milliseconds since Epoch) to NTFS time.
|
static long |
toUnixTime(java.nio.file.attribute.FileTime fileTime)
Converts
FileTime to standard UNIX time. |
static java.nio.file.attribute.FileTime |
truncateToHundredNanos(java.nio.file.attribute.FileTime fileTime)
Truncates a FileTime to 100-nanosecond precision.
|
static java.nio.file.attribute.FileTime |
unixTimeToFileTime(long time)
Converts standard UNIX time (in seconds, UTC/GMT) to
FileTime. |
public static boolean isUnixTime(java.nio.file.attribute.FileTime time)
TODO ? If the FileTime is null, this method always returns true.
time - the FileTime to evaluate, can be null.public static boolean isUnixTime(long seconds)
seconds - the number of seconds (since Epoch) to evaluate.@Deprecated public static java.util.Date ntfsTimeToDate(long ntfsTime)
FileTimes.ntfsTimeToDate(long).ntfsTime - the NTFS time in 100 nanosecond units.@Deprecated public static java.nio.file.attribute.FileTime ntfsTimeToFileTime(long ntfsTime)
FileTimes.ntfsTimeToFileTime(long).ntfsTime - the NTFS time in 100-nanosecond units.FileTimes.toNtfsTime(FileTime)@Deprecated public static java.util.Date toDate(java.nio.file.attribute.FileTime fileTime)
FileTimes.toDate(FileTime).FileTime to a Date. If the provided FileTime is null, the returned Date is also null.fileTime - the file time to be converted.Date which corresponds to the supplied time, or null if the time is null.FileTimes.toFileTime(Date)@Deprecated public static java.nio.file.attribute.FileTime toFileTime(java.util.Date date)
FileTimes.toFileTime(Date).Date to a FileTime. If the provided Date is null, the returned FileTime is also null.date - the date to be converted.FileTime which corresponds to the supplied date, or null if the date is null.FileTimes.toDate(FileTime)@Deprecated public static long toNtfsTime(java.util.Date date)
FileTimes.toNtfsTime(Date).Date to NTFS time.date - the Date.@Deprecated public static long toNtfsTime(java.nio.file.attribute.FileTime fileTime)
FileTimes.toNtfsTime(FileTime).FileTime to NTFS time (100-nanosecond units since 1 January 1601).fileTime - the FileTime.FileTimes.ntfsTimeToFileTime(long)public static long toNtfsTime(long javaTime)
javaTime - the Java time.public static long toUnixTime(java.nio.file.attribute.FileTime fileTime)
FileTime to standard UNIX time.fileTime - the original FileTime.public static java.nio.file.attribute.FileTime truncateToHundredNanos(java.nio.file.attribute.FileTime fileTime)
fileTime - the FileTime to be truncated.public static java.nio.file.attribute.FileTime unixTimeToFileTime(long time)
FileTime.time - UNIX timestamp (in seconds, UTC/GMT).Copyright © 2010 - 2024 Adobe. All Rights Reserved