-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added .cvsignore files and changed how dates are presented in the GUI.
- Loading branch information
Showing
4 changed files
with
45 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*~ | ||
*.class | ||
.DS_Store | ||
Thumbs.db |
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,4 @@ | ||
*~ | ||
*.class | ||
.DS_Store | ||
Thumbs.db |
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,32 @@ | ||
import java.util.*; | ||
import java.text.*; | ||
|
||
/** | ||
* Reference to how the field HFSPlusDate.DIFF_TO_JAVA_DATE_IN_MILLIS is calculated. | ||
*/ | ||
public class DateCalc { | ||
public static void main(String[] args) { | ||
Date d = new Date(0); // the exact date of the start of the epoch | ||
// HFS+ dates start at January 1, 1904, GMT, so we need to | ||
// find out the difference in milliseconds between those two dates. | ||
TimeZone usedTZ = TimeZone.getTimeZone("GMT+00:00"); | ||
System.out.println(usedTZ); | ||
System.out.println(usedTZ.useDaylightTime()); | ||
Calendar c1 = Calendar.getInstance(usedTZ); | ||
c1.setTime(d); | ||
c1.set(1904, 0, 1); | ||
Calendar c2 = Calendar.getInstance(usedTZ); | ||
c2.setTime(d); | ||
System.out.println("c1: " + c1); | ||
System.out.println("c2: " + c2); | ||
DateFormat dti = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); | ||
dti.setTimeZone(usedTZ); | ||
System.out.println("c1.getTime(): " + dti.format(c1.getTime())); | ||
System.out.println("c2.getTime(): " + dti.format(c2.getTime())); | ||
System.out.println("d: " + dti.format(d)); | ||
System.out.println("c1.getTime().getTime(): " + c1.getTime().getTime()); | ||
System.out.println("c2.getTime().getTime(): " + c2.getTime().getTime()); | ||
System.out.println("d.getTime(): " + d.getTime()); | ||
System.out.println("Diff in millis: " + (c2.getTime().getTime()-c1.getTime().getTime())); | ||
} | ||
} |
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