mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -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:
@ -2728,16 +2728,15 @@ void logevent_dlg(void *estuff, const char *string)
|
||||
struct eventlog_stuff *es = (struct eventlog_stuff *)estuff;
|
||||
|
||||
char timebuf[40];
|
||||
time_t t;
|
||||
struct tm tm;
|
||||
|
||||
if (es->nevents >= es->negsize) {
|
||||
es->negsize += 64;
|
||||
es->events = sresize(es->events, es->negsize, char *);
|
||||
}
|
||||
|
||||
time(&t);
|
||||
strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S\t",
|
||||
localtime(&t));
|
||||
tm=ltime();
|
||||
strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S\t", &tm);
|
||||
|
||||
es->events[es->nevents] = snewn(strlen(timebuf) + strlen(string) + 1, char);
|
||||
strcpy(es->events[es->nevents], timebuf);
|
||||
|
Reference in New Issue
Block a user