# Miscellaneous objects appearing in all the network utilities (not
# Pageant or PuTTYgen).
MISC = timing misc version settings tree234 proxy
-WINMISC = MISC winstore winnet cmdline windefs winmisc pproxy
-UXMISC = MISC uxstore uxsel uxnet cmdline uxmisc uxproxy
+WINMISC = MISC winstore winnet cmdline windefs winmisc pproxy wintime
+UXMISC = MISC uxstore uxsel uxnet cmdline uxmisc uxproxy time
MACMISC = MISC macstore macnet mtcpnet otnet macmisc macabout pproxy
# Character set library, for use in pterm.
puttygen : [G] winpgen sshrsag sshdssg sshprime sshdes sshbn sshmd5 version
+ sshrand winnoise sshsha winstore misc winctrls sshrsa sshdss winmisc
+ sshpubk sshaes sshsh512 import winutils puttygen.res tree234
- + notiming LIBS
+ + notiming LIBS wintime
pterm : [X] UXTERM uxmisc misc ldisc settings uxpty uxsel BE_NONE uxstore
- + uxsignal CHARSET cmdline uxpterm version
+ + uxsignal CHARSET cmdline uxpterm version time
putty : [X] UXTERM uxmisc misc ldisc settings uxpty uxsel BE_ALL uxstore
+ uxsignal CHARSET uxputty NONSSH UXSSH UXMISC ux_x11
puttytel : [X] UXTERM uxmisc misc ldisc settings uxpty uxsel BE_NOSSH
puttygen : [U] cmdgen sshrsag sshdssg sshprime sshdes sshbn sshmd5 version
+ sshrand uxnoise sshsha misc sshrsa sshdss uxcons uxstore uxmisc
- + sshpubk sshaes sshsh512 import puttygen.res tree234 uxgen notiming
+ + sshpubk sshaes sshsh512 import puttygen.res time tree234 uxgen
+ + notiming
pscp : [U] pscp uxsftp uxcons UXSSH BE_SSH SFTP wildcard UXMISC
psftp : [U] psftp uxsftp uxcons UXSSH BE_SSH SFTP UXMISC
if (keytype != NOKEYGEN) {
char *entropy;
char default_comment[80];
- time_t t;
- struct tm *tm;
+ struct tm tm;
struct progress prog;
prog.phase = -1;
prog.current = -1;
- time(&t);
- tm = localtime(&t);
+ tm = ltime();
if (keytype == DSA)
- strftime(default_comment, 30, "dsa-key-%Y%m%d", tm);
+ strftime(default_comment, 30, "dsa-key-%Y%m%d", &tm);
else
- strftime(default_comment, 30, "rsa-key-%Y%m%d", tm);
+ strftime(default_comment, 30, "rsa-key-%Y%m%d", &tm);
random_ref();
entropy = get_random_data(bits / 8);
{
struct LogContext *ctx = (struct LogContext *)handle;
char buf[256];
- time_t t;
struct tm tm;
char writemod[4];
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);
#include <stdio.h> /* for FILE * */
#include <stdarg.h> /* for va_list */
+#include <time.h> /* for struct_tm */
#ifndef FALSE
#define FALSE 0
void bufchain_consume(bufchain *ch, int len);
void bufchain_fetch(bufchain *ch, void *data, int len);
+struct tm ltime(void);
+
/*
* Debugging functions.
*
--- /dev/null
+#include <time.h>
+#include <assert.h>
+
+struct tm ltime(void)
+{
+ time_t t;
+ time(&t);
+ assert (t != ((time_t)-1));
+ return *localtime(&t);
+}
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);
void logevent(void *frontend, const char *string)
{
char timebuf[40];
- time_t t;
+ struct tm tm;
log_eventlog(logctx, string);
events = sresize(events, 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);
events[nevents] = snewn(strlen(timebuf) + strlen(string) + 1, char);
strcpy(events[nevents], timebuf);
*/
*state->commentptr = snewn(30, char);
{
- time_t t;
- struct tm *tm;
- time(&t);
- tm = localtime(&t);
+ struct tm tm;
+ tm = ltime();
if (state->is_dsa)
- strftime(*state->commentptr, 30, "dsa-key-%Y%m%d", tm);
+ strftime(*state->commentptr, 30, "dsa-key-%Y%m%d", &tm);
else
- strftime(*state->commentptr, 30, "rsa-key-%Y%m%d", tm);
+ strftime(*state->commentptr, 30, "rsa-key-%Y%m%d", &tm);
}
/*
--- /dev/null
+#include "putty.h"
+#include <time.h>
+
+struct tm ltime(void)
+{
+ SYSTEMTIME st;
+ struct tm tm;
+
+ GetLocalTime(&st);
+ tm.tm_sec=st.wSecond;
+ tm.tm_min=st.wMinute;
+ tm.tm_hour=st.wHour;
+ tm.tm_mday=st.wDay;
+ tm.tm_mon=st.wMonth-1;
+ tm.tm_year=(st.wYear>=1900?st.wYear-1900:0);
+ tm.tm_wday=st.wDayOfWeek;
+ tm.tm_yday=-1; /* GetLocalTime doesn't tell us */
+ tm.tm_isdst=0; /* GetLocalTime doesn't tell us */
+ return tm;
+}