y2k issue (dclock -date "%Y" or "%y" will not be printed right)

http://home.jp.FreeBSD.org/cgi-bin/showmail/ports-jp/8465
Message-Id: <20000101012747R.tagami@sra.co.jp>
From: Takao TAGAMI <tagami@sra.co.jp>
To: ports-jp@jp.FreeBSD.ORG
Subject: [ports-jp 8465] Y2K bug dclock
This commit is contained in:
itojun 1999-12-31 17:29:08 +00:00
parent 75def84f7d
commit c83bac661c
2 changed files with 24 additions and 1 deletions

View file

@ -1,5 +1,6 @@
$NetBSD: patch-sum,v 1.2 1999/10/20 11:02:25 agc Exp $
$NetBSD: patch-sum,v 1.3 1999/12/31 17:29:08 itojun Exp $
MD5 (patch-aa) = b0a7daf0ae06bbf8f85f07b36f5aea35
MD5 (patch-ab) = 014efaa8ae11f187896ad6607e3fc0ba
MD5 (patch-ac) = e334cb6a3f14ac3d893c258063dce668
MD5 (patch-ad) = f292a53f7e022ab2bb5f952438ad03fd

View file

@ -0,0 +1,22 @@
$NetBSD: patch-ad,v 1.1 1999/12/31 17:29:09 itojun Exp $
y2k
--- Dclock.c.orig Sat Jan 1 02:24:07 2000
+++ Dclock.c Sat Jan 1 02:25:10 2000
@@ -891,11 +891,12 @@
*datep++ = now->tm_mday % 10 + '0';
break;
case 'Y':
- *datep++ = '1', *datep++ = '9';
+ *datep++ = (now->tm_year + 1900) / 1000 + '0';
+ *datep++ = (now->tm_year + 1900) % 1000 / 100 + '0';
/* FALLTHROUGH */
case 'y':
- *datep++ = now->tm_year / 10 + '0';
- *datep++ = now->tm_year % 10 + '0';
+ *datep++ = now->tm_year % 100 / 10 + '0';
+ *datep++ = now->tm_year % 10 + '0';
break;
case '%':
*datep++ = *p;