Re: [閒聊] 關於strtotime的最終日期2038-01-19 03 …
※ 引述《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
推
07/12 17:45, , 1F
07/12 17:45, 1F
討論串 (同標題文章)