Fix localtime function.