time_t t;
struct tm tm;
void logevent(void *frontend, const char *string){    char timebuf[40];    time_t t;    log_eventlog(logctx, string);    if (nevents >= negsize) {	negsize += 64;	events = sresize(events, negsize, char *);    }    time(&t);    strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S\t",	     localtime(&t));    events[nevents] = snewn(strlen(timebuf) + strlen(string) + 1, char);    strcpy(events[nevents], timebuf);    strcat(events[nevents], string);    if (logbox) {	int count;	SendDlgItemMessage(logbox, IDN_LIST, LB_ADDSTRING,			   0, (LPARAM) events[nevents]);	count = SendDlgItemMessage(logbox, IDN_LIST, LB_GETCOUNT, 0, 0);	SendDlgItemMessage(logbox, IDN_LIST, LB_SETTOPINDEX, count - 1, 0);    }    nevents++;}