2 #include <crtdll/sys/time.h>
5 int month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31};
6 unsigned int _getsystime(struct tm *tp)
9 TIME_ZONE_INFORMATION TimeZoneInformation;
15 tp->tm_year = Time.wYear - 1900;
16 tp->tm_mon = Time.wMonth - 1;
17 tp->tm_wday = Time.wDayOfWeek;
18 tp->tm_mday = Time.wDay;
19 tp->tm_hour = Time.wHour;
20 tp->tm_min = Time.wMinute;
21 tp->tm_sec = Time.wSecond;
25 //FIXME GetTimeZoneInformation currently not in kernel32
27 //TimeZoneId = GetTimeZoneInformation(&TimeZoneInformation );
28 //if ( TimeZoneId == TIME_ZONE_ID_DAYLIGHT ) {
36 if ( tp->tm_year%4 == 0 ) {
37 if (tp->tm_year%100 != 0 )
39 else if ( (tp->tm_year-100)%1000 == 0 )
43 for(i=0;i<=tp->tm_mon;i++)
44 tp->tm_yday += month[i];
46 return Time.wMilliseconds;
50 unsigned int _setsystime(struct tm *tp, unsigned int ms)
54 Time.wYear = tp->tm_year + 1900;
55 Time.wMonth = tp->tm_mon + 1;
56 Time.wDayOfWeek = tp->tm_wday;
57 Time.wDay = tp->tm_mday;
58 Time.wHour = tp->tm_hour;
59 Time.wMinute = tp->tm_min;
60 Time.wSecond = tp->tm_sec;
61 Time.wMilliseconds = ms;
63 if ( !SetLocalTime(&Time))