Date: Sun, 2 Jan 2000 23:46:52 -0500 (EST) From: sean@stat.Duke.EDU To: FreeBSD-gnats-submit@freebsd.org Subject: ports/15854: -date flag in dclock not Y2K compliant :) Message-ID: <200001030446.XAA83361@bobzilla.adsl.duke.edu>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001030446.XAA83361>