[PATCH] kill sys_tz.tz_dsttime

Andries.Brouwer en cwi.nl Andries.Brouwer en cwi.nl
Mar Ene 25 19:03:55 CST 2000


The tz_dsttime field of a struct tz is constant during the year.
It does not indicate whether Daylight Saving Time is in effect
right now, but, long ago, it did indicate which algorithm is
used in this country to compute start and end of DST.

However, some kernel authors have used tz_dsttime as a field
indicating a number of hours DST shift. This causes problems,
and the patch below removes all uses of tz_dsttime from the
kernel.

User programs that want to influence the kernel's idea of
the local time have to set tz_minuteswest appropriately.

Andries


diff -u --recursive --new-file ../linux-2.3.40/linux/fs/fat/misc.c ./linux/fs/fat/misc.c
--- ../linux-2.3.40/linux/fs/fat/misc.c	Mon Aug 30 19:23:14 1999
+++ ./linux/fs/fat/misc.c	Tue Jan 25 15:27:35 2000
@@ -338,7 +338,6 @@
 	    month < 2 ? 1 : 0)+3653);
 			/* days since 1.1.70 plus 80's leap day */
 	secs += sys_tz.tz_minuteswest*60;
-	if (sys_tz.tz_dsttime) secs -= 3600;
 	return secs;
 }
 
diff -u --recursive --new-file ../linux-2.3.40/linux/fs/hpfs/hpfs_fn.h ./linux/fs/hpfs/hpfs_fn.h
--- ../linux-2.3.40/linux/fs/hpfs/hpfs_fn.h	Mon Dec 13 16:59:51 1999
+++ ./linux/fs/hpfs/hpfs_fn.h	Tue Jan 25 15:27:10 2000
@@ -64,13 +64,13 @@
 extern inline time_t local_to_gmt(struct super_block *s, time_t t)
 {
 	extern struct timezone sys_tz;
-	return t + sys_tz.tz_minuteswest * 60 - (sys_tz.tz_dsttime ? 3600 : 0) +s->s_hpfs_timeshift;
+	return t + sys_tz.tz_minuteswest * 60 + s->s_hpfs_timeshift;
 }
 
 extern inline time_t gmt_to_local(struct super_block *s, time_t t)
 {
 	extern struct timezone sys_tz;
-	return t - sys_tz.tz_minuteswest * 60 + (sys_tz.tz_dsttime ? 3600 : 0) -s->s_hpfs_timeshift;
+	return t - sys_tz.tz_minuteswest * 60 - s->s_hpfs_timeshift;
 }
 
 /*
diff -u --recursive --new-file ../linux-2.3.40/linux/fs/isofs/util.c ./linux/fs/isofs/util.c
--- ../linux-2.3.40/linux/fs/isofs/util.c	Wed Jun 24 23:30:10 1998
+++ ./linux/fs/isofs/util.c	Tue Jan 25 15:26:00 2000
@@ -126,8 +126,6 @@
 		days += day - 1;
 		crtime = ((((days * 24) + hour) * 60 + minute) * 60)
 			+ second;
-		if (sys_tz.tz_dsttime)
-			crtime -= 3600;
 
 		/* sign extend */
 		if (tz & 0x80)
@@ -149,7 +147,7 @@
 		 * NOTE: mkisofs in versions prior to mkisofs-1.10 had
 		 * the sign wrong on the timezone offset.  This has now
 		 * been corrected there too, but if you are getting screwy
-		 * results this may be the explaination.  If enough people
+		 * results this may be the explanation.  If enough people
 		 * complain, a user configuration option could be added
 		 * to add the timezone offset in with the wrong sign
 		 * for 'compatibility' with older discs, but I cannot see how
diff -u --recursive --new-file ../linux-2.3.40/linux/fs/udf/udftime.c ./linux/fs/udf/udftime.c
--- ../linux-2.3.40/linux/fs/udf/udftime.c	Sat Oct 30 18:42:30 1999
+++ ./linux/fs/udf/udftime.c	Tue Jan 25 15:28:12 2000
@@ -139,7 +139,7 @@
 
 	gettimeofday(&tv, &sys_tz);
 #endif
-	offset = (-sys_tz.tz_minuteswest + (sys_tz.tz_dsttime ? 60 : 0));
+	offset = (-sys_tz.tz_minuteswest);
 
     if (!dest)
         return NULL;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



Más información sobre la lista de distribución Ayuda