[jcifs] timezone problems

Jason Bainbridge Jason.Bainbridge at bmssolutions.com
Thu Mar 11 18:24:36 GMT 2004


I haven't really been following this thread so I might be way off track
here but we once had similar problems with Timezones when using Tomcat,
it turned out that in one of the Service Packs (2 I think) for Win 2000
MS did something to screw with the default timezone for Java and simply
changing the system timezone to a wrong one and then changing it back.

Regards,
Jason

-----Original Message-----
From: Julian Reschke [mailto:julian.reschke at gmx.de] 
Sent: Friday, 12 March 2004 12:45
To: Julian Reschke
Cc: jcifs at lists.samba.org; Christopher R. Hertel
Subject: Re: [jcifs] timezone problems

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