1. 38
  1.  

  2. 3

    What are the situations where you’d never want to use this ever? I can think of at least not on a database server or anything that has to sync data elsewhere - but if I have a stupid web app running on one machine can I default to thinking this is safe to experiment with?

    1. 5

      According to the Apache source code, this can “gain about 2% in raw requests/second” (since logs are formatted with the local time, if present).

      1. 1

        OK, but what are the side effects? I don’t see how your link (while otherwise informative) answers my question.

        1. 2

          Any system that really cares about storing time robustly will have a system timezone of UTC (i.e. it won’t ever change, since it will always be UTC) and furthermore will ensure all time is stored in UTC. So this is always safe, assuming that you were making an effort beforehand to be safe with time.

          1. 3

            isn’t the point of TZ-aware stuff to be that you don’t have to set your system timezone to UTC?

            Though I’m of the “implicit system locales shouldn’t exist” crowd so…

            1. 1

              If the edge of your internal representation / user interface is the local system, then sure. But if you’re sending the time somewhere else—like a web server to a browser—you should still send it in UTC. If you’re “TZ-aware” before you should be, that messes crap up.

      2. 4

        I suppose the danger would be that a long-running process would not pick up time zone changes, and you would not notice? I dunno, there’s probably something bigger I’m missing? I think the default gives a sort of absolute correctness guarantee, which may be misguided by some of our judgements, but at least it’s not wrong.

      3. 2

        Would this also affect FreeBSD?

        1. 4

          Looks like it doesn’t affect FreeBSD, going by the sample code given in the article and running ktrace on it =)

        2. 2

          I would dearly love to know if this affects musl & alpine, too.

          1. 5

            No its another glibcism.

            / # strace ./a.out
            execve("./a.out", ["./a.out"], [/* 6 vars */]) = 0
            arch_prctl(ARCH_SET_FS, 0x7f315882cb48) = 0
            set_tid_address(0x7f315882cb80)         = 37
            mprotect(0x7f3158829000, 4096, PROT_READ) = 0
            mprotect(0x55ca798c1000, 4096, PROT_READ) = 0
            ioctl(1, TIOCGWINSZ, {ws_row=49, ws_col=149, ws_xpixel=0, ws_ypixel=0}) = 0
            writev(1, [{iov_base="Greetings!", iov_len=10}, {iov_base="\n", iov_len=1}], 2Greetings!
            ) = 11
            open("/etc/localtime", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 3
            fstat(3, {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
            mmap(NULL, 118, PROT_READ, MAP_SHARED, 3, 0) = 0x7f3158828000
            close(3)                                = 0
            writev(1, [{iov_base="Godspeed, dear friend!", iov_len=22}, {iov_base="\n", iov_len=1}], 2Godspeed, dear friend!
            ) = 23
            exit_group(0)                           = ?
            +++ exited with 0 +++
            / # env |grep TZ
            / # TZ=utc strace ./a.out
            execve("./a.out", ["./a.out"], [/* 7 vars */]) = 0
            arch_prctl(ARCH_SET_FS, 0x7f54c46edb48) = 0
            set_tid_address(0x7f54c46edb80)         = 42
            mprotect(0x7f54c46ea000, 4096, PROT_READ) = 0
            mprotect(0x5611a118f000, 4096, PROT_READ) = 0
            ioctl(1, TIOCGWINSZ, {ws_row=49, ws_col=149, ws_xpixel=0, ws_ypixel=0}) = 0
            writev(1, [{iov_base="Greetings!", iov_len=10}, {iov_base="\n", iov_len=1}], 2Greetings!
            ) = 11
            writev(1, [{iov_base="Godspeed, dear friend!", iov_len=22}, {iov_base="\n", iov_len=1}], 2Godspeed, dear friend!
            ) = 23
            exit_group(0)                           = ?
            +++ exited with 0 +++
            
            1. 1

              Ace. Thanks!