Are there any Java libraries around for dealing with the win32 FILETIME/ time intervals ? It\'s basically a 64 bit timestamp in 100ns intervals since January 1, 1601.
(
If you are fine with millisecond resolution, this would work:
/** Difference between Filetime epoch and Unix epoch (in ms). */
private static final long FILETIME_EPOCH_DIFF = 11644473600000L;
/** One millisecond expressed in units of 100s of nanoseconds. */
private static final long FILETIME_ONE_MILLISECOND = 10 * 1000;
public static long filetimeToMillis(final long filetime) {
return (filetime / FILETIME_ONE_MILLISECOND) - FILETIME_EPOCH_DIFF;
}
public static long millisToFiletime(final long millis) {
return (millis + FILETIME_EPOCH_DIFF) * FILETIME_ONE_MILLISECOND;
}
At this point, converting from ms to a Date object is quite straightforward.