Цитата:
Сообщение от SergVK
Внутрь блока не заглянешь. Какая функция конкретно можно озвучить? Полазить по описаниям.
|
GetDays()
DWORD * ClassLogix::getDays(DWORD * cp, WORD )
struct tm * tinfo = GetLocalTime();
*(pDWORD)(*(cp++)) = DateToDays(tinfo->tm_mday, tinfo->tm_mon + 1, tinfo->tm_year + 1900);
)
static int day_tab[12] = {0,31,59,90,120,151,181,212,243,273,304,334};
static unsigned long DateToDays(signed int _day, signed int _month, signed int _year)
{
unsigned long days;
unsigned int quot;
unsigned int rem;
if(_year <= 0) _year = 2000;
if(_month <= 0) _month = 1;
if(_month > 12) _month = 12;
if(_day <= 0) _day = 1;
quot = (_year - 1) / 4;
rem = (_year - 1) - quot * 4;
days = ((unsigned long)quot * (4 * 365 + 1)) + ((unsigned long)rem * 365);
quot = 0;
if ((rem == 3) && (_month >= 2))
{
if(_month == 2)
quot = 1;
else days++;
}
rem = day_tab[_month - 1] + _day;
if(_month == 12)
quot += 365;
else quot += day_tab[_month];
if(rem > quot)
days += quot;
else days += rem;
days %= 766661L;
if(days < 730135L) days = 730135L;
return days;
}