On Sun, Nov 04 2012, Blake Jones wrote: > Hi Jani, > >> I'd prefer to use timegm() where available, and the suggested >> alternative [1] elsewhere. >> >> [1] http://www.kernel.org/doc/man-pages/online/pages/man3/timegm.3.html > > I considered this alternative, but decided against it because it's > completely MT-unsafe. I don't know whether libnotmuch itself is > MT-safe, but a process which called this routine in one thread would > temporarily throw off any timezone-related work that any other threads > were doing, even if they weren't using libnotmuch. Yet another idea for an alternative. Compile by entering 'sh xtimegm.c' and then run ./xtimegm Simple cases seems to work. Dst change may (or then may not) give one hour difference to the expected. The test "coverage" could be easily expanded to that ;) Hmm, I also found this: http://lists.gnu.org/archive/html/bug-gnulib/2003-09/msg00004.html which does 2 mktime's and one gmtime_r (without allocating tg!)... Pick any of these 3 -- or something different (e.g. less NIH if there is) > Blake Tomi