From owner-freebsd-ports Sun Jan 2 20:50: 4 2000 Delivered-To: freebsd-ports@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id BD6DE152D2 for ; Sun, 2 Jan 2000 20:50:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id UAA99243; Sun, 2 Jan 2000 20:50:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from wilson.acpub.duke.edu (wilson.acpub.duke.edu [152.3.233.69]) by hub.freebsd.org (Postfix) with ESMTP id 6DFDF1509E for ; Sun, 2 Jan 2000 20:46:58 -0800 (PST) (envelope-from sto@stat.Duke.EDU) Received: from bobzilla.adsl.duke.edu (bobzilla.adsl.duke.edu [152.16.67.15]) by wilson.acpub.duke.edu (8.9.3/8.9.3/Duke-5.0.0) with ESMTP id XAA29162; Sun, 2 Jan 2000 23:46:53 -0500 (EST) Received: (from sto@localhost) by bobzilla.adsl.duke.edu (8.9.3/8.9.3) id XAA83361; Sun, 2 Jan 2000 23:46:52 -0500 (EST) (envelope-from sto) Message-Id: <200001030446.XAA83361@bobzilla.adsl.duke.edu> Date: Sun, 2 Jan 2000 23:46:52 -0500 (EST) From: sean@stat.Duke.EDU Reply-To: sean@stat.Duke.EDU To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: ports/15854: -date flag in dclock not Y2K compliant :) Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 15854 >Category: ports >Synopsis: dclock -date "%y" (or %Y) do not correctly handle 2000 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 2 20:50:01 PST 2000 >Closed-Date: >Last-Modified: >Originator: Sean O'Connell >Release: FreeBSD 4.0-CURRENT i386 >Organization: Duke University >Environment: This appears universally in dclock .. of all patchlevels >Description: dclock uses localtime and in particular the references to tm_year and does not take into accoutn the year 2000 and beyond >How-To-Repeat: dclock -date "The year is %Y" will show The year is 19:0 underneath the time >Fix: The following patch (albeit inelegant) will fix the behavior (of course, we could probably lose the condition for tm_year < 100, but I thought it would be more fun to include it: The following patch was applied to Dclock.c after the patch-ab and the patches from the PATCHSITE --- Dclock.c.y2ko Sun Jan 2 23:33:27 2000 +++ Dclock.c Sun Jan 2 23:34:51 2000 @@ -1000,10 +1000,16 @@ *datep++ = (now->tm_mday / 10 + '0'); *datep++ = now->tm_mday % 10 + '0'; when 'Y': - *datep++ = '1', *datep++ = '9'; + if (now->tm_year < 100) + *datep++ = '1', *datep++ = '9'; + else + *datep++ = '2', *datep++ = '0'; /* fall thru */ case 'y': - *datep++ = now->tm_year / 10 + '0'; + if (now->tm_year < 100) + *datep++ = now->tm_year / 10 + '0'; + else + *datep++ = (now->tm_year - 100) / 10 + '0'; *datep++ = now->tm_year % 10 + '0'; when '%': *datep++ = *p; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message