Debian 的 64-bit time_t 計畫

在「Debian: 64-bit time_t transition in progress」這邊看到 Debian 的 mailing list 上的討論:「64-bit time_t transition in progress」,另外官方也有整理 wiki page:「64-bit time」。

因為技術上無法表示 2038/01/19 以後的時間,確定會 breaking ABI 將 time_t 從 32-bit 變成 64-bit,而現在要想辦法搞定 32-bit 平台上面可以處理這樣的改變:

The goal of this transition is to ensure that 32-bit architectures in trixie (whether they are currently release architectures, or out of archive, etc) will be capable of handling current and future timestamps referring to times beyond 2038.

離 2038/01/17 還有約 13 年多...

印 "#" 比印 "B" 來的快的問題

這篇是兩年前在 StackOverflow 上的問題:「Why is printing “B” dramatically slower than printing “#”?」。

問問題的人這段程式跑了 8.52 秒:

Random r = new Random();
for (int i = 0; i < 1000; i++) {
    for (int j = 0; j < 1000; j++) {
        if(r.nextInt(4) == 0) {
        } else {


而把上面的 # 換成 B 就變成 259.152 秒。

答案是與 word-wrapping 有關:

Pure speculation is that you're using a terminal that attempts to do word-wrapping rather than character-wrapping, and treats B as a word character but # as a non-word character. So when it reaches the end of a line and searches for a place to break the line, it sees a # almost immediately and happily breaks there; whereas with the B, it has to keep searching for longer, and may have more text to wrap (which may be expensive on some terminals, e.g., outputting backspaces, then outputting spaces to overwrite the letters being wrapped).

But that's pure speculation.

這真是細節 XDDD