Nikolay Sivov : comctl32/monthcal: Reuse existing calls to get day of week.
Alexandre Julliard
julliard at winehq.org
Mon Oct 12 11:19:44 CDT 2009
Module: wine
Branch: master
Commit: a00c217ce910bc20f5c40a0a864c588dc720bf37
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a00c217ce910bc20f5c40a0a864c588dc720bf37
Author: Nikolay Sivov <bunglehead at gmail.com>
Date: Sat Oct 10 21:20:26 2009 +0400
comctl32/monthcal: Reuse existing calls to get day of week.
---
dlls/comctl32/monthcal.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index fc73537..d75526a 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -131,10 +131,6 @@ typedef struct
WNDPROC EditWndProc; /* original Edit window procedure */
} MONTHCAL_INFO, *LPMONTHCAL_INFO;
-
-/* Offsets of days in the week to the weekday of january 1 in a leap year */
-static const int DayOfWeekTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
-
static const WCHAR themeClass[] = { 'S','c','r','o','l','l','b','a','r',0 };
/* empty SYSTEMTIME const */
@@ -389,10 +385,18 @@ static void MONTHCAL_CopyDate(const SYSTEMTIME *from, SYSTEMTIME *to)
*/
int MONTHCAL_CalculateDayOfWeek(WORD day, WORD month, WORD year)
{
- year-=(month < 3);
+ FILETIME ft;
+ SYSTEMTIME st;
+
+ st.wYear = year;
+ st.wMonth = month;
+ st.wDay = day;
+ st.wHour = st.wMinute = st.wSecond = st.wMilliseconds = 0;
+
+ SystemTimeToFileTime(&st, &ft);
+ FileTimeToSystemTime(&ft, &st);
- return((year + year/4 - year/100 + year/400 +
- DayOfWeekTable[month-1] + day ) % 7);
+ return st.wDayOfWeek;
}
/* properly updates date to point on next month */
More information about the wine-cvs
mailing list