Changeset 2997


Ignore:
Timestamp:
07/19/07 12:25:58 (13 years ago)
Author:
melissa
Message:

Fixed timestamps and added a fix for the change to the memory chunk header.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/LIFReader.java

    r2976 r2997  
    172172 
    173173      int blockLength = in.readInt(); 
    174       if (in.read() != 0x2a) { 
    175         throw new FormatException("Invalid Memory Description"); 
     174      if (in.read() != 0x2a) {  
     175        in.skipBytes(3); 
     176        if (in.read() != 0x2a) { 
     177          throw new FormatException("Invalid Memory Description"); 
     178        }  
    176179      } 
    177180 
     
    651654        // the timestamp will not be parsed correctly. 
    652655 
    653         long seconds = stamp / 10000000; 
     656        long ms = stamp / 10000; 
    654657 
    655658        // subtract number of seconds until Unix epoch (Jan 1, 1970) 
    656659 
    657         long secondsPerYear = (long) (60 * 60 * 24 * 365.25); 
    658         seconds -= secondsPerYear * (1970 - 1601); 
    659  
    660         Date d = new Date(seconds * 1000); 
     660        ms -= 11644444800000L; 
     661 
     662        Date d = new Date(ms); 
    661663        SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); 
    662664        StringBuffer sb = new StringBuffer(); 
    663665        fmt.format(d, sb, new FieldPosition(0)); 
    664         addMeta(series + " - TimeStamp " + count, sb.toString()); 
    665  
     666         
     667        String n = String.valueOf(count); 
     668        while (n.length() < 4) n = "0" + n; 
     669        addMeta(series + " - TimeStamp " + n, sb.toString()); 
    666670        count++; 
    667671      } 
Note: See TracChangeset for help on using the changeset viewer.