4668. [bug] Use localtime_r and gmtime_r for thread safety. [RT #45664]