1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-14 01:27:35 -05:00

New function ltime() returns a struct tm of the current local time.

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]
This commit is contained in:
Owen Dunn
2005-01-09 14:27:48 +00:00
parent 3669401216
commit 06434ffc71
9 changed files with 54 additions and 28 deletions

View File

@ -169,7 +169,6 @@ void logfopen(void *handle)
{
struct LogContext *ctx = (struct LogContext *)handle;
char buf[256];
time_t t;
struct tm tm;
char writemod[4];
@ -181,8 +180,7 @@ void logfopen(void *handle)
return;
sprintf(writemod, "wb"); /* default to rewrite */
time(&t);
tm = *localtime(&t);
tm = ltime();
/* substitute special codes in file name */
xlatlognam(&ctx->currlogfilename, ctx->cfg.logfilename,ctx->cfg.host, &tm);