1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32: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:
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

@ -602,19 +602,17 @@ int main(int argc, char **argv)
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);