Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Mar 2004 00:30:50 +0200 (CEST)
From:      Johannes Groedem <johs@copyleft.no>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/64871: Leap year calculation is broken in cvstrac.
Message-ID:  <200403282230.i2SMUod07899@justice.copyleft.no>
Resent-Message-ID: <200403282240.i2SMe9rv090554@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         64871
>Category:       ports
>Synopsis:       Leap year calculation is broken in cvstrac.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 28 14:40:08 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Johannes Groedem
>Release:        FreeBSD 4.5-RELEASE-p5 i386
>Organization:
Copyleft Software AS
>Environment:
>Description:
	Leap year calculation is broken, so that CVS check-ins are assigned
	wrong dates in the cvstrac-web-interface.  Attached patch fixes it.
	(I've also submitted it to the cvstrac-author.)
>How-To-Repeat:
	Just do a check-in.  It will appear on cvstrac's timeline to have
	been checked in one day earlier than the actual day of the check-in.
>Fix:
	Apply patch.

--- patch-history.c begins here ---
--- history.c	5 Apr 2003 16:04:21 -0000	1.28
+++ history.c	28 Mar 2004 21:01:11 -0000
@@ -155,7 +155,7 @@
     p->tm_year += p->tm_mon/12;
     p->tm_mon %= 12;
   }
-  isLeapYr = p->tm_year/4==0 && (p->tm_year/100!=0 || (p->tm_year+300)/400==0);
+  isLeapYr = p->tm_year%4==0 && (p->tm_year%100!=0 || p->tm_year%400==0);
   p->tm_yday = priorDays[p->tm_mon] + p->tm_mday - 1;
   if( isLeapYr && p->tm_mon>1 ) p->tm_yday++;
   nDay = (p->tm_year-70)*365 + (p->tm_year-69)/4 -p->tm_year/100 + 
--- patch-history.c ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403282230.i2SMUod07899>