Use thread-safe ecvt_r instead of ecvt