荔园在线
荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀
[回到开始]
[上一篇][下一篇]
发信人: jjksam (电死你), 信区: Linux
标 题: Re: 发现linux的一个bug
发信站: 荔园晨风BBS站 (Thu May 31 10:01:42 2001), 转信
今天man了cal一下,发现我的想法是错的,manual里有以下说明:
The Gregorian Reformation is assumed to have occurred in 1752 on the 3rd
of September. By this time, most countries had recognized the reformation
(although a few did not recognize it until the early 1900's.) Ten
days following that date were eliminated by the reformation, so the calendar
for that month is a bit unusual.
HISTORY
A cal command appeared in Version 6 AT&T UNIX.
BSD Experimental June 6, 1993 1
原来有历史原因的,在1752年9月3日时,公历改了而且那个月少了十天的,
所以 <=1752年的二月份都有29日!
cal 9 1752的输出
如下:
Sep 1752
Su Mo Tu We Th Fr Sa |
1 2 14 15 16 | 怪吧!编程时没想到吧!只用那个条件判断是不行的!
17 18 19 20 21 22 23 | 但大多数人都只用那个条件,不过也不能怪他们(包括我)
24 25 26 27 28 29 30 | 谁那么有时间去研究历史啊,呵呵!
【 在 jjksam (电死你) 的大作中提到: 】
其实这个问题很早就发现了,不过现在才记得贴出来讨论一下
不知道你们有没有注意到,用cal这个命令的时候的输出,
例如:
cal 2 100
Feb 100
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
输出的月份竟然有29号,明明100年不是闰年,难道算法有错?!
但是cal 2 1000又没有错
~~~~~~~~~~~~~今天试了一下,输出如下
Feb 1000
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29
--
The bird wishes it were a
cloud,
The cloud wishes it were a
bird.
※ 修改:·jjksam 於 Oct 29 09:35:46 修改本文·[FROM: 192.168.0.146]
※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.46.1]
[回到开始]
[上一篇][下一篇]
荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店