OSDN Git Service

Fix bugs of simultaneous connection.
[ffftp/ffftp.git] / contrib / putty / WINDOWS / WINTIME.C
1 /*\r
2  * wintime.c - Avoid trouble with time() returning (time_t)-1 on Windows.\r
3  */\r
4 \r
5 #include "putty.h"\r
6 #include <time.h>\r
7 \r
8 struct tm ltime(void)\r
9 {\r
10     SYSTEMTIME st;\r
11     struct tm tm;\r
12 \r
13     GetLocalTime(&st);\r
14     tm.tm_sec=st.wSecond;\r
15     tm.tm_min=st.wMinute;\r
16     tm.tm_hour=st.wHour;\r
17     tm.tm_mday=st.wDay;\r
18     tm.tm_mon=st.wMonth-1;\r
19     tm.tm_year=(st.wYear>=1900?st.wYear-1900:0);\r
20     tm.tm_wday=st.wDayOfWeek;\r
21     tm.tm_yday=-1; /* GetLocalTime doesn't tell us */\r
22     tm.tm_isdst=0; /* GetLocalTime doesn't tell us */\r
23     return tm;\r
24 }\r