-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added functionality to parse HFS+ dates.
- Loading branch information
Showing
4 changed files
with
42 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import java.util.Date; | ||
|
||
/** In the future, this should wrap a 32 bit HFS+ date. */ | ||
|
||
public class HFSPlusDate { | ||
/** | ||
* Pre-calculated. This is the amount of milliseconds between 01-01-1904 00:00:00.0000 | ||
* (HFS+ starting date) and 01-01-1970 00:00:00.0000 (the start of the java "epoch"). | ||
*/ | ||
public static final long DIFF_TO_JAVA_DATE_IN_MILLIS = 2082844800000L; | ||
|
||
/** Converts a HFS+ date to a Java Date. */ | ||
public static Date toDate(int hfsPlusTimestamp) { | ||
return new Date(Util2.unsign(hfsPlusTimestamp)*1000 - DIFF_TO_JAVA_DATE_IN_MILLIS); | ||
} | ||
} |