今天阅读 go/src/time.go 源码,遇到下面几个常量:
const (
secondsPerMinute = 60
secondsPerHour = 60 * secondsPerMinute
secondsPerDay = 24 * secondsPerHour
secondsPerWeek = 7 * secondsPerDay
daysPer400Years = 365*400 + 97
daysPer100Years = 365*100 + 24
daysPer4Years = 365*4 + 1
)
对如下两个常量心存疑惑
daysPer400Years = 365*400 + 97
daysPer100Years = 365*100 + 24
为何不是
daysPer400Years = 365*400 + 100
daysPer100Years = 365*100 + 25
搜索引擎上搜索无果,遂赴 * 发帖提问。正写着帖子,突然自己想明白了这个问题,遂自答之。
帖子如下:
https://*.com/questions/67681571/in-golang-go-src-time-go-why-daysper100years-365100-24/67681572