Skip to content

Commit

Permalink
Added .cvsignore files and changed how dates are presented in the GUI.
Browse files Browse the repository at this point in the history
  • Loading branch information
unsound committed Nov 4, 2006
1 parent 79af432 commit d7e3e36
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .cvsignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*~
*.class
.DS_Store
Thumbs.db
4 changes: 4 additions & 0 deletions src/.cvsignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*~
*.class
.DS_Store
Thumbs.db
32 changes: 32 additions & 0 deletions src/DateCalc.java
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()));
}
}
7 changes: 5 additions & 2 deletions src/FileSystemBrowserWindow.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.catacombae.hfsexplorer.gui.FilesystemBrowserPanel;
import java.util.*;
import java.io.*;
import java.text.DateFormat;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
Expand Down Expand Up @@ -444,15 +445,17 @@ public void populateTable(HFSPlusCatalogLeafRecord[] contents) {
currentRow.add(new RecordContainer(rec));
currentRow.add(catFile.getDataFork().getLogicalSize() + " B");
currentRow.add("File");
currentRow.add("" + catFile.getContentModDateAsDate());
DateFormat dti = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
currentRow.add("" + dti.format(catFile.getContentModDateAsDate()));
}
else if(recData.getRecordType() == HFSPlusCatalogLeafRecordData.RECORD_TYPE_FOLDER &&
recData instanceof HFSPlusCatalogFolder) {
HFSPlusCatalogFolder catFolder = (HFSPlusCatalogFolder)recData;
currentRow.add(new RecordContainer(rec));
currentRow.add("");
currentRow.add("Folder");
currentRow.add("" + catFolder.getContentModDateAsDate());
DateFormat dti = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
currentRow.add("" + dti.format(catFolder.getContentModDateAsDate()));
}
else if(recData.getRecordType() == HFSPlusCatalogLeafRecordData.RECORD_TYPE_FOLDER_THREAD &&
recData instanceof HFSPlusCatalogThread) {
Expand Down

0 comments on commit d7e3e36

Please sign in to comment.