Small DST fix to 2.0.35 smbfs (at least NT 3.51+4 need it)

Ulrik Dickow (
Mon, 27 Jul 1998 01:43:54 +0200

[ Warning: patch not yet tested against Win95/98 and Win3.11 ]

Problem: During the Summer, when the local time involves a non-zero Daylight
Saving Time (DST) shift, smbfs in Linux 2.0.35 (and presumably all 2.0.x
kernels since 2.0.15 or earlier) get and put mtime/ctime/atime's that
disagree with the NT side's view, no matter whether the NT machine has its
automatic DST correction option on or off, and no matter its time zone (I
tried lots of combinations of correction/zone/time in vain).

This is true for NT 3.51 SP 5 as well as NT 4.0 SP3. I don't know about
Win95/98 and Win3.11.

The simple patch below seems to fix this problem. At least it does so for
me now, with the aforementioned NT versions with automatic DST correction on.

Maybe it creates a DST problem for Win9* and/or Win3.11???

But then again, the ncpfs, fat and isofs file systems all do the equivalent
DST correction. In fact, the patch makes a larger section of smbfs code
completely identical to a chunk of code in fs/ncpfs/dir.c.

====== Patch begin =========================================================
--- linux-2.0.35/fs/smbfs/proc.c.shipped Thu Jun 4 00:17:49 1998
+++ linux-2.0.35/fs/smbfs/proc.c Sun Jul 26 23:59:11 1998
@@ -205,13 +205,13 @@
static int
utc2local(int time)
- return time - sys_tz.tz_minuteswest * 60;
+ return time - sys_tz.tz_minuteswest * 60 + sys_tz.tz_dsttime * 3600;

static int
local2utc(int time)
- return time + sys_tz.tz_minuteswest * 60;
+ return time + sys_tz.tz_minuteswest * 60 - sys_tz.tz_dsttime * 3600;

/* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */
====== Patch end ============================================================

Here's a bit more detail to the bug history:

> Date: Mon, 2 Dec 1996 17:22:43 +0100
> From: Ulrik Dickow <>
> To:
> Subject: smbfs in 2.0.27: mtime OK (but DST maybe not?)
> [...]
> In Spring 1997, when Daylight Saving Time returns to Europe, it will be
> interesting to see whether another bug reappears:
> The smbfs in e.g. kernel 2.0.15 didn't agree with my NT 3.51 servers about
> who should add/subtract the one hour difference. Thus, files created by
> NT programs were seen by Linux to be one hour newer than they really were;
> and files created by Linux were of course one hour too old on NT.
> (My NT servers have an X in the "Automatically correct for DST" box in
> the "Date/Time" group of the Control Panel; I think this is the default).
> I didn't bother to report the bug; I just waited for DST to cease, expecting
> the difference to disappear, as indeed it did (with 2.0.15).

And it did indeed reappear in the Summer of 1997, but again I chose to ignore
it and just blame NT for being stupid :-) (I actually set back the NT time 1
hour during the Summer, so that everything seemed normal from smbfs' point of
view, and only a local login on NT would show a problem).

Thanks go to Carsten Wimmer for reporting a similar problem a few weeks ago
and thus finally provoking the appearance of this solution (for NT).

Ulrik Dickow, Systems Programmer           Snail Mail: Kampsax Technology
E-mail:                                 Stamholmen 112
Phone:  +45 36 39 08 00                                DK-2650 Hvidovre
Fax:    +45 36 77 03 01                                Denmark

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to Please read the FAQ at