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

📄 readme.timegm

📁 一个很有名的浏览器
💻 TIMEGM
字号:
This file contains description of our my_timegm() function in date.c. It wasposted as a mail to links-list by Stephane Chazelas, and I thought it may beinteresting for someone, so I decided to include it in the ELinks distribution.Un explanation for it as one (me to start with) may wonder whythis works.We first change of calendar. To make things easy, let's saythat 0/0/0 0:0:0 in our new calendar is the Marsh 1st 1968, sojust after a february 29th as 1968 was a leap year.if y/m/d h:min:s is time in our calendarand   Y/M/D h:min:s in the new calendarM = m - 1 - 2 (+ 12 if m < 3)Y = y - 68 (-1 if m < 3)D = d - 1at Y/0/0 0:0:0, there has been Y / 4 leap years in the past, so(int) 365 * Y + Y / 4 days have past.at Y/M/0 0:0:0, lets find how many days have past since Y/0/0:                   |Mar                                        Feb                  M| 0   1   2   3   4   5   6   7   8   9  10  11-------------------+----------------------------------------------- days in that month|31  30  31  30  31  31  30  31  30  31  31  28 or 29-------------------+-----------------------------------------------  x = days at Y/M/0| 0  31  61  92 122 153 184 214 245 275 306 337-------------------+-----------------------------------------------first approximation|         y = 30 * M| 0  30  60  90 120 150 180 210 240 270 300 330-------------------+-----------------------------------------------              x - y| 0   1   1   2   2   3   4   4   5   5   6   7-------------------+-----------------------------------------------(M + 4) * 3 / 5 - 2| 0   1   1   2   2   3   4   4   5   5   6   7-------------------+-----------------------------------------------x - y = (M + 4) * 3 / 5 - 2x = 30 * M + (M + 4) * 3 / 5 - 2x = (153 * M + 2) / 5So at Y/M/D 0:0:0,Y * 1461 / 4 + (153 * M + 2) / 5 + D days have past sincethe 1st of March of 19681st of March of 1968 was 671 days before 1970 Jan 1st (year 0for unix time())Sot = s + 60 * (min + 60 * (h + 24 * (Y * 1461 / 4 + (153 * M + 2) / 5 + D - 671)))t = s + 60 * (min + 60 * (h + 24 * (Y * 1461 / 4 + (153 * M + 2) / 5 + d - 672)))This shouldn't work past 2100/02/28 23:59:59 as 2100 is not a leap year.--St閜hane

⌨️ 快捷键说明

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