localtime code from glibc