2006-04-23 22:26:03 +04:00
|
|
|
/*
|
|
|
|
* wintime.c - Avoid trouble with time() returning (time_t)-1 on Windows.
|
|
|
|
*/
|
|
|
|
|
2005-01-09 17:27:48 +03:00
|
|
|
#include "putty.h"
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
struct tm ltime(void)
|
|
|
|
{
|
|
|
|
SYSTEMTIME st;
|
|
|
|
struct tm tm;
|
|
|
|
|
2017-02-14 23:29:38 +03:00
|
|
|
memset(&tm, 0, sizeof(tm)); /* in case there are any other fields */
|
|
|
|
|
2005-01-09 17:27:48 +03:00
|
|
|
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;
|
|
|
|
}
|