From mi@rtfm.ziplink.net  Fri Oct 31 07:16:24 1997
Received: from ziplink.net (relay-0.ziplink.net [199.232.240.13])
          by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id HAA13707
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 31 Oct 1997 07:16:19 -0800 (PST)
          (envelope-from mi@rtfm.ziplink.net)
Received: from aldan.ziplink.net (aldan.ziplink.net [199.232.255.49])
	by ziplink.net (8.8.7/8.8.7) with ESMTP id KAA20431
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 31 Oct 1997 10:12:10 -0500 (EST)
Received: from rtfm.ziplink.net (rtfm [199.232.255.52])
	by aldan.ziplink.net (8.8.5/8.8.5) with ESMTP id KAA06943
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 31 Oct 1997 10:15:15 -0500 (EST)
Received: (from mi@localhost)
	by rtfm.ziplink.net (8.8.7/8.8.5) id KAA09313;
	Fri, 31 Oct 1997 10:16:47 -0500 (EST)
Message-Id: <199710311516.KAA09313@rtfm.ziplink.net>
Date: Fri, 31 Oct 1997 10:16:47 -0500 (EST)
From: Mikhail Teterin <mi@aldan.ziplink.net>
Reply-To: mi@aldan.algebra.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: 33+ days in October, according to calendar(1)
X-Send-Pr-Version: 3.2

>Number:         4907
>Category:       bin
>Synopsis:       Oct 33* Daylight Savings Time ends; clocks move back (Last Sunday in October)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    n_hibma
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 31 07:20:01 PST 1997
>Closed-Date:    Sat Jul 24 09:28:46 PDT 1999
>Last-Modified:  Sat Jul 24 09:30:09 PDT 1999
>Originator:     Mikhail Teterin
>Release:        FreeBSD 3.0-970807-SNAP i386
>Organization:
Virtual Estates, Inc.
>Environment:


>Description:

	See synopsis :) The

10/SunLast      Daylight Savings Time ends; clocks move back (Last Sunday in Oct
ober)
	line from the /usr/share/calendar/calendar.usholiday was processed as

Oct 33* Daylight Savings Time ends; clocks move back (Last Sunday in October)

>How-To-Repeat:

  mi@rtfm:~ (1011) calendar -f /usr/share/calendar/calendar.usholiday
  33 * Daylight Savings Time ends; clocks move back (Last Sunday in October)

	You may need to tweak the date if you do this after Nov 2, 1997.

>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: n_hibma 
State-Changed-When: Sat Jul 24 05:37:25 PDT 1999 
State-Changed-Why:  
Problem still there and should be fixed I guess. 


Responsible-Changed-From-To: freebsd-bugs->n_hibma 
Responsible-Changed-By: n_hibma 
Responsible-Changed-When: Sat Jul 24 05:37:25 PDT 1999 
Responsible-Changed-Why:  
I guess that I can fix this one. Bored on a saturday, wasn't it Doug? 

From: Nick Hibma <nick.hibma@jrc.it>
To: freebsd-gnats-submit@freebsd.org, mi@aldan.algebra.com
Cc:  
Subject: Re: bin/4907: Oct 33* Daylight Savings Time ends; clocks move back (Last 
 Sunday in October)
Date: Sat, 24 Jul 1999 14:36:14 +0200

 calendar -f /usr/share/calendar/calendar.usholiday\
 	-A 400 -B 400 -t 31.10.1997
 
 will reproduce the problem. And it will colour your computer blue as
 well, but that is a minor issue.
 -- 
 ISIS/STA, T.P.270, Joint Research Centre, 21020 Ispra, Italy
 

From: Nick Hibma <nick.hibma@jrc.it>
To: freebsd-gnats-submit@freebsd.org, mi@aldan.algebra.com
Cc:  
Subject: Re: bin/4907: Oct 33* Daylight Savings Time ends; clocks move back (Last 
 Sunday in October)
Date: Sat, 24 Jul 1999 17:44:49 +0200

 Please try the following patch:
 
 Index: day.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/calendar/day.c,v
 retrieving revision 1.11
 diff -u -r1.11 day.c
 --- day.c       1997/10/26 12:51:30     1.11
 +++ day.c       1999/07/24 15:38:47
 @@ -325,7 +325,8 @@
                     v2 = tp->tm_mday + (((day - 1) - tp->tm_wday + 7) %
 7);
  
                     /* (month length - day) / 7 + 1 */
 -                   if (((int)((cumdays[month+1] - 
 +                   if (cumdays[month+1] - cumdays[month] >= v2
 +                       && ((int)((cumdays[month+1] - 
                                cumdays[month] - v2) / 7) + 1) == -v1)
                         /* bingo ! */
                         day = v2;
 
 And -B is broken as well. So don't use 
 calendar -f /usr/share/calendar/calendar.usholiday\
 	-A 400 -B 400 -t 31.10.1997
 
 But use
 calendar -f /usr/share/calendar/calendar.usholiday -t 31.10.1997
 
 THe problem is the devision by 7, which in the case of v2 (day in month)
 being bigger than the number of days in that specific month divides a
 value smaller than zero by 7. In that case it gets the range wrong.
 
 	m-v2		v1 must be
 	-7 - -1	->	0 <-- this one is the culprit
 	0 - 6	->	0
 	7 - 13	->	1
 	14 - 20	->	2
 	etc.
 
 Cheers,
 Nick
 -- 
 ISIS/STA, T.P.270, Joint Research Centre, 21020 Ispra, Italy
 
State-Changed-From-To: analyzed->closed 
State-Changed-By: n_hibma 
State-Changed-When: Sat Jul 24 09:28:46 PDT 1999 
State-Changed-Why:  
Corrected in rev 1.12 of calendar/day.c 
>Unformatted:
