[jcifs] timezone problems
Julian Reschke
julian.reschke at gmx.de
Thu Mar 11 16:45:04 GMT 2004
OK,
here are some more facts.
I'm testing with:
1) Cygwin "date" (options -u -r reffile)
2) Windows scripting host: date.js
var fso, f, s;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFile(WScript.Arguments(0));
WScript.Echo("mod: " + f.DateLastModified);
3) java.io.File / JCifs:
public static void main(String[] args) throws IOException {
if (args.length != 2) {
System.err.println("usage: TestTimeStamps smb-uri filename");
System.exit(2);
}
System.out.println("== TIMEZONE INFO ==");
System.out.println("Default TimeZone is: " + TZ);
System.out.println();
System.out.println("== JAVA.IO.FILE INFO ==");
File fsummer = new File(args[1] + "fsummer");
long tsr = fsummer.lastModified();
System.out.println("file summer lastmod: " + tsr + " " + new Date(tsr));
File fwinter = new File(args[1] + "fwinter");
tsr = fwinter.lastModified();
System.out.println("file winter lastmod: " + tsr + " " + new Date(tsr));
System.out.println();
System.out.println("== JCIFS.SMB.SMMFILE INFO ==");
SmbFile smbsummer = new SmbFile(args[0] + "fsummer");
tsr = smbsummer.lastModified();
System.out.println("smb summer lastmod: " + tsr + " " + new Date(tsr));
SmbFile smbwinter = new SmbFile(args[0] + "fwinter");
tsr = smbwinter.lastModified();
System.out.println("smb winter lastmod: " + tsr + " " + new Date(tsr));
System.out.println();
}
Result: all of the tools agree on the dates, except for
JCifs.Smb.SmbFile. Even Windows Explorer shows the correct dates
(running with JDK 1.4.2, Windows2000, NTFS).
Regards, Julian
--
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760
More information about the jcifs
mailing list