2 #include <msvcrt/sys/time.h>
5 int month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31};
10 unsigned int _getsystime(struct tm* tp)
13 TIME_ZONE_INFORMATION TimeZoneInformation;
19 tp->tm_year = Time.wYear - 1900;
20 tp->tm_mon = Time.wMonth - 1;
21 tp->tm_wday = Time.wDayOfWeek;
22 tp->tm_mday = Time.wDay;
23 tp->tm_hour = Time.wHour;
24 tp->tm_min = Time.wMinute;
25 tp->tm_sec = Time.wSecond;
29 //FIXME GetTimeZoneInformation currently not in kernel32
31 //TimeZoneId = GetTimeZoneInformation(&TimeZoneInformation );
32 //if ( TimeZoneId == TIME_ZONE_ID_DAYLIGHT ) {
38 if (tp->tm_year % 4 == 0) {
39 if (tp->tm_year % 100 != 0)
41 else if ((tp->tm_year-100) % 1000 == 0)
45 for (i = 0; i <= tp->tm_mon; i++)
46 tp->tm_yday += month[i];
48 return Time.wMilliseconds;
55 unsigned int _setsystime(struct tm* tp, unsigned int ms)
59 Time.wYear = tp->tm_year + 1900;
60 Time.wMonth = tp->tm_mon + 1;
61 Time.wDayOfWeek = tp->tm_wday;
62 Time.wDay = tp->tm_mday;
63 Time.wHour = tp->tm_hour;
64 Time.wMinute = tp->tm_min;
65 Time.wSecond = tp->tm_sec;
66 Time.wMilliseconds = ms;
68 if (!SetLocalTime(&Time))