⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.cal

📁 Util-linux 软件包包含许多工具。其中比较重要的是加载、卸载、格式化、分区和管理硬盘驱动器
💻 CAL
字号:
The cal(1) date routines were written from scratch, basically from firstprinciples.  The algorithm for calculating the day of week from anyGregorian date was "reverse engineered".  This was necessary as most ofthe documented algorithms have to do with date calculations for othercalendars (e.g. julian) and are only accurate when converted to gregorianwithin a narrow range of dates.1 Jan 1 is a Saturday because that's what cal says and I couldn't changethat even if I was dumb enough to try.  From this we can easily calculatethe day of week for any date.  The algorithm for a zero based day of week:	calculate the number of days in all prior years (year-1)*365	add the number of leap years (days?) since year 1 		(not including this year as that is covered later)	add the day number within the year		this compensates for the non-inclusive leap year		calculation	if the day in question occurs before the gregorian reformation		(3 sep 1752 for our purposes), then simply return 		(value so far - 1 + SATURDAY's value of 6) modulo 7.	if the day in question occurs during the reformation (3 sep 1752		to 13 sep 1752 inclusive) return THURSDAY. This is my		idea of what happened then. It does not matter much as		this program never tries to find day of week for any day		that is not the first of a month.	otherwise, after the reformation, use the same formula as the		days before with the additional step of subtracting the		number of days (11) that were adjusted out of the calendar		just before taking the modulo.It must be noted that the number of leap years calculation is sensitiveto the date for which the leap year is being calculated.  A year that occursbefore the reformation is determined to be a leap year if its modulo of4 equals zero.  But after the reformation, a year is only a leap year ifits modulo of 4 equals zero and its modulo of 100 does not.  Of course,there is an exception for these century years.  If the modulo of 400 equalszero, then the year is a leap year anyway.  This is, in fact, what thegregorian reformation was all about (a bit of error in the old algorithmthat caused the calendar to be inaccurate.)Once we have the day in year for the first of the month in question, therest is trivial.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -