Ethereal-dev: [ethereal-dev] Problems with dates in SMB decodes

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Richard Sharpe <sharpe@xxxxxxxxxx>
Date: Mon, 27 Sep 1999 06:44:32 +0900
Hi,

well, I have the dates sorted ... Thanks to looking at what Samba does,

There are [at least] three date formates in the SMB protocol. What a mess.

1. DOS_DATE, where date is 7bits for year, 4 bits for month, 5 bits for day.
             time is some funny set of bits that are irrelevant here

2. Unix like date format, two 16 bit USHORTS get put together to yield a
   localtime (local to the server) seconds since the epoch.

   This is easy to handle, just call gmtime after whacking the two shorts
   together.

3. 100ns time format since 1601.  This is a long long, and will be a real
   hard case to handle. Samba divides by 10**7 to get back to seconds and
   then subtracts 369 years (taking into account leap years and hours)
   and then I should be able to call gmtime.

My first attempt forgot about adding back 1900, but dates and times look
better now.


Regards
-------
Richard Sharpe, sharpe@xxxxxxxxxx, Master Linux Administrator :-),
Samba (Team member, www.samba.org), Ethereal (Team member, www.zing.org)
Co-author, SAMS Teach Yourself Samba in 24 Hours
Author: First Australian 5-day, intensive, hands-on Linux SysAdmin course