前幾天 Twitter 伺服器的時間大爆炸,跳到 2015 年:
I MITMed Twitter for Android's login to see why it was failing.
The Twitter servers think it's 2015. Amazing. pic.twitter.com/iEu4rEUub9
— Ninji the [REDACTED] (@_Ninji) December 29, 2014
剛剛在 Hacker News Daily 上看到原因:「If you're using YYYY in your JVM service or %G in anything, fix it now」,原因是這樣:
The single character G instead of Y took down Twitter's API today.
If you're using YYYY in your JVM service or %G in anything, fix it now. You're very likely using the wrong year format.date
Mon Dec 29 00:44:45 EST 2014
date -u "+%G"
2015ISO 8601 week numbering has 2015 start this week.
在自己電腦上也可以重製出來:
gslin@home [~] [01:22/W4] date Wed Dec 31 01:27:00 CST 2014 gslin@home [~] [01:27/W4] date +%Y 2014 gslin@home [~] [01:27/W4] date +%G 2015
依照說明,%G
的用途是:
year of ISO week number (see %V); normally useful only with %V
用錯好慘啊...