作者LPH66 (-858993460)
看板PHP
标题Re: [闲聊] 关於strtotime的最终日期2038-01-19 03 …
时间Thu Jul 8 20:39:31 2010
※ 引述《liaosankai (低温烘焙)》之铭言:
: 话说…程式中使用了一些strtotime的部分
: 官方提醒此函式最多能转到2038-01-19 03:14:07那个秒点
: 但官方也说明在新的PHP版本和较新的作业系统将会克服这些局限
: @_@想跟大家讨论如果万一没办法去更新PHP或作业系统的情况下
: 那麽有什麽更好方式(写法),可以避免在2038-01-19所发生的囧境
: 我个人想最土法链钢的方法是,宣告一个同名strtotime()的函式
: 切开日期字串,再用数学的方式去算,不过感觉好麻烦~__~
: 看来只有升级一途了...
这其实是 32-bit 系统的极限
http://en.wikipedia.org/wiki/Year_2038_problem
http://zh.wikipedia.org/zh-tw/2038%E5%B9%B4%E9%97%AE%E9%A2%98
所以你所谓的升级大概只能是升到 64-bit 了
(因为 32-bit 的系统就是只能处理到这里 除非後端有做特殊处理)
这个 strtotime 大概是取字元後丢给後面的 mktime (in C) 去处理的
所以才会有这个限制
--
'You've sort of made up for it tonight,' said Harry. 'Getting the
sword. Finishing the Horcrux. Saving my life.'
'That makes me sound a lot cooler then I was,' Ron mumbled.
'Stuff like that always sounds cooler then it really was,' said
Harry. 'I've been trying to tell you that for years.'
-- Harry Potter and the Deathly Hollows, P.308
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.28.92
1F:推 liaosankai:感谢,多学了一些知识=v= 07/12 17:45