2 #include <msvcrt/sys/time.h>
5 int month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31};
7 unsigned int _getsystime(struct tm* tp)
10 TIME_ZONE_INFORMATION TimeZoneInformation;
16 tp->tm_year = Time.wYear - 1900;
17 tp->tm_mon = Time.wMonth - 1;
18 tp->tm_wday = Time.wDayOfWeek;
19 tp->tm_mday = Time.wDay;
20 tp->tm_hour = Time.wHour;
21 tp->tm_min = Time.wMinute;
22 tp->tm_sec = Time.wSecond;
26 //FIXME GetTimeZoneInformation currently not in kernel32
28 //TimeZoneId = GetTimeZoneInformation(&TimeZoneInformation );
29 //if ( TimeZoneId == TIME_ZONE_ID_DAYLIGHT ) {
35 if (tp->tm_year % 4 == 0) {
36 if (tp->tm_year % 100 != 0)
38 else if ((tp->tm_year-100) % 1000 == 0)
42 for (i = 0; i <= tp->tm_mon; i++)
43 tp->tm_yday += month[i];
45 return Time.wMilliseconds;
49 unsigned int _setsystime(struct tm* tp, unsigned int ms)
53 Time.wYear = tp->tm_year + 1900;
54 Time.wMonth = tp->tm_mon + 1;
55 Time.wDayOfWeek = tp->tm_wday;
56 Time.wDay = tp->tm_mday;
57 Time.wHour = tp->tm_hour;
58 Time.wMinute = tp->tm_min;
59 Time.wSecond = tp->tm_sec;
60 Time.wMilliseconds = ms;
62 if (!SetLocalTime(&Time))