Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsliebig2008-10-21 12:55:43 +0000
committersliebig2008-10-21 12:55:43 +0000
commitd2de2a071ce57fb9e56d75d73e18e88e48cf3f78 (patch)
tree319a28956f8dc0777a1bc182ef4b981ad0da05d1 /bundles/org.eclipse.equinox.p2.sar/src
parent5c74f44f236d774314af8a3fe8179d32ed1bc8f3 (diff)
downloadrt.equinox.p2-d2de2a071ce57fb9e56d75d73e18e88e48cf3f78.tar.gz
rt.equinox.p2-d2de2a071ce57fb9e56d75d73e18e88e48cf3f78.tar.xz
rt.equinox.p2-d2de2a071ce57fb9e56d75d73e18e88e48cf3f78.zip
replaced deprecated usage
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.sar/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarEntry.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarEntry.java b/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarEntry.java
index 8a2f2730b..08279afdf 100644
--- a/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarEntry.java
+++ b/bundles/org.eclipse.equinox.p2.sar/src/org/eclipse/equinox/internal/p2/sar/SarEntry.java
@@ -12,7 +12,7 @@
package org.eclipse.equinox.internal.p2.sar;
import java.io.IOException;
-import java.util.Date;
+import java.util.*;
import java.util.zip.ZipEntry;
/**
@@ -164,20 +164,25 @@ public class SarEntry extends ZipEntry {
* Converts DOS time to Java time (number of milliseconds since epoch).
*/
public final static long dosToJavaTime(long dtime) {
- Date d = new Date((int) (((dtime >> 25) & 0x7f) + 80), (int) (((dtime >> 21) & 0x0f) - 1), (int) ((dtime >> 16) & 0x1f), (int) ((dtime >> 11) & 0x1f), (int) ((dtime >> 5) & 0x3f), (int) ((dtime << 1) & 0x3e));
- return d.getTime();
+ GregorianCalendar cal = new GregorianCalendar((int) (((dtime >> 25) & 0x7f) + 80) + 1900, (int) (((dtime >> 21) & 0x0f) - 1), (int) ((dtime >> 16) & 0x1f), (int) ((dtime >> 11) & 0x1f), (int) ((dtime >> 5) & 0x3f), (int) ((dtime << 1) & 0x3e));
+ return cal.getTime().getTime();
}
/*
* Converts Java time to DOS time.
*/
public final static long javaToDosTime(long time) {
- Date d = new Date(time);
- int year = d.getYear() + 1900;
- if (year < 1980) {
+ GregorianCalendar cal = new GregorianCalendar();
+ cal.setTime(new Date(time));
+ int year = cal.get(Calendar.YEAR);
+ if (year < 1980)
return (1 << 21) | (1 << 16);
- }
- return (year - 1980) << 25 | (d.getMonth() + 1) << 21 | d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 | d.getSeconds() >> 1;
+ int month = cal.get(Calendar.MONTH);
+ int date = cal.get(Calendar.DAY_OF_MONTH);
+ int hours = cal.get(Calendar.HOUR_OF_DAY);
+ int minutes = cal.get(Calendar.MINUTE);
+ int seconds = cal.get(Calendar.SECOND);
+ return (year - 1980) << 25 | (month + 1) << 21 | date << 16 | hours << 11 | minutes << 5 | seconds >> 1;
}
}

Back to the top