From: gunter z. <gun...@us...> - 2005-02-25 10:57:52
|
Update of /cvsroot/dcm4che/dcm4che14/src/java/org/dcm4che/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv661/src/java/org/dcm4che/util Modified Files: DTFormat.java TMFormat.java Log Message: FIX broken DT string<->date conversion Index: DTFormat.java =================================================================== RCS file: /cvsroot/dcm4che/dcm4che14/src/java/org/dcm4che/util/DTFormat.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DTFormat.java 11 May 2003 18:56:39 -0000 1.4 --- DTFormat.java 25 Feb 2005 10:57:25 -0000 1.5 *************** *** 48,73 **** try { String s = parseTZ(source); int l = s.length(); calendar.set(Calendar.YEAR, ! Integer.parseInt(s.substring(0,4))); ! pos.setIndex(4); ! if (l > 4) { calendar.set(Calendar.MONTH, ! Integer.parseInt(s.substring(4,6)) - 1); ! pos.setIndex(6); ! if (l > 6) { calendar.set(Calendar.DAY_OF_MONTH, ! Integer.parseInt(s.substring(6,8))); ! pos.setIndex(8); ! if (l > 8) { calendar.set(Calendar.HOUR_OF_DAY, ! Integer.parseInt(s.substring(8,10))); ! pos.setIndex(10); ! if (l > 10) { calendar.set(Calendar.MINUTE, ! Integer.parseInt(s.substring(10,12))); ! pos.setIndex(12); ! if (l > 12) { ! float f = Float.parseFloat(s.substring(12)); int i = (int) f; calendar.set(Calendar.SECOND, i); --- 48,86 ---- try { String s = parseTZ(source); + int p = 0; int l = s.length(); calendar.set(Calendar.YEAR, ! Integer.parseInt(s.substring(p,p+4))); ! pos.setIndex(p+=4); ! if (l > p) { ! if (s.charAt(p) == '-') { ! pos.setIndex(++p); ! } calendar.set(Calendar.MONTH, ! Integer.parseInt(s.substring(p,p+2)) - 1); ! pos.setIndex(p+=2); ! if (l > p) { ! if (s.charAt(p) == '-') { ! pos.setIndex(++p); ! } calendar.set(Calendar.DAY_OF_MONTH, ! Integer.parseInt(s.substring(p,p+2))); ! pos.setIndex(p+=2); ! if (l > p) { calendar.set(Calendar.HOUR_OF_DAY, ! Integer.parseInt(s.substring(p,p+2))); ! pos.setIndex(p+=2); ! if (l > p) { ! if (s.charAt(p) == ':') { ! pos.setIndex(++p); ! } calendar.set(Calendar.MINUTE, ! Integer.parseInt(s.substring(p,p+2))); ! pos.setIndex(p+=2); ! if (l > p) { ! if (s.charAt(p) == ':') { ! pos.setIndex(++p); ! } ! float f = Float.parseFloat(s.substring(p)); int i = (int) f; calendar.set(Calendar.SECOND, i); Index: TMFormat.java =================================================================== RCS file: /cvsroot/dcm4che/dcm4che14/src/java/org/dcm4che/util/TMFormat.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TMFormat.java 23 Feb 2005 14:31:24 -0000 1.3 --- TMFormat.java 25 Feb 2005 10:57:25 -0000 1.4 *************** *** 51,55 **** public TMFormat() { super("HHmmss.SSS"); - setTimeZone(TimeZone.getTimeZone("GMT")); } --- 51,54 ---- |