There are two parts to this task: 1. Change e.g. localtime calls to e.g. localtime_r calls. 2. Remove Core Foundation calls and replace with true unix calls. The CF stuff was a performance hack that we no longer need. The non-_r time/date functions are not thread-safe or re-entrant. This can cause surprising bugs due to more than one time/date call in the same call stack or using date code on multiple threads.
Actually, on Darwin, localtime() uses a per-thread global <http://darwinsource.opendarwin.org/10.4.2/ Libc-391/stdtime/FreeBSD/localtime.c>. A lot of other functions that used to operate on static globals do the same. MS Windows doesn't have localtime_r at all (if Windows portability is a concern).
OK, thread safety is no longer a concern. The call stack problem remains, but I suppose that just calls for careful coding. So, let's use this bug just to track the switch away from CF calls.
To fix bug 5280, I recommended we do this. And my patch attached to bug 5280 does this.
Changing the bug name to reflect that the remaining work is to switch away from CF calls. *** This bug has been marked as a duplicate of 5280 ***