[jcifs] Finding the server's time zone
jcifs-user
jcifs-user at mailinator.com
Mon Jun 1 15:28:07 GMT 2009
Thanks. Since I don't really want to change the library, I ended up creating
a class within the jcifs.smb package which returns the time zone.
jcifs-user.
Michael B Allen wrote:
>
> On Mon, Jun 1, 2009 at 7:21 AM, jcifs-user <jcifs-user at mailinator.com>
> wrote:
>>
>> Hello, I've just started using jCIFS and so far it's great. However, I've
>> run
>> into a bit of a problem; I need to find the time zone of the samba server
>> to
>> which I'm connecting. At first, I thought of perhaps creating a new
>> temporary file on the server via SmbFile.createNewFile() and checking
>> it's
>> createTime() or lastModified(), however, these seemed to return the time
>> relative to my computer (as opposed to the server's).
>> I know that while connecting to the server it does send it's timezone,
>> but I
>> can't seem to figure out how to access it (it's part of the ServerInfo of
>> the SmbTransport, but there's no public way of accessing it, AFAIK).
>
> There's actually a field in the SMB_COM_NEGOTIATE_RESPONSE called
> ServerTimeZone that indicates the TZ in minutes relative to UTC. JCIFS
> does not have a method to retrieve that value but you could easily add
> one to SmbFile like:
>
> public int getTimeZone() throws SmbException
> {
> connect0();
> return tree.session.transport.server.serverTimeZone;
> }
>
> You could then use this with any SMB URL. IPC$ is probably good
> because every server has one:
>
> SmbFile f = new SmbFile("smb://server.example.com/IPC$");
> int tzMinutes = f.getTimeZone();
>
> You could also extend SmbFile without actually modifying the JCIFS
> package but the package would have to be the jcifs.smb namespace to
> access the package protected stuff and the solution could of course
> break at any time.
>
> Mike
>
> --
> Michael B Allen
> Java Active Directory Integration
> http://www.ioplex.com/
>
>
--
View this message in context: http://www.nabble.com/Finding-the-server%27s-time-zone-tp23813476p23816823.html
Sent from the Samba - jcifs mailing list archive at Nabble.com.
More information about the jcifs
mailing list