Fixes crashes when time() returns (time_t)-1 on Windows by using the Win32 GetLocalTime() function. (The Unix implementation still just uses time() and localtime().) [originally from svn r5086]