Chinaunix首页 | 论坛 | 博客
  • 博客访问: 329696
  • 博文数量: 67
  • 博客积分: 2485
  • 博客等级: 大尉
  • 技术积分: 665
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-20 17:29
文章分类

全部博文(67)

文章存档

2016年(3)

2013年(5)

2012年(3)

2011年(5)

2010年(35)

2009年(16)

我的朋友

分类: C/C++

2011-11-04 14:04:25

UINT8 MMI_GetWeekday(int rlYear, int rlMonth, int rlDay)
{
    int a, y, m, d, temp, temp1, temp2, temp3;
    a = (14 - rlMonth) / 12;
    y = rlYear - a;
    m = rlMonth + (12 * a) - 2;
    temp3 = rlDay + y + (y / 4);
    temp = y / 100;
    temp1 = y / 400;
    temp2 = (31 * m) / 12;
    d = temp3 - temp + temp1 + temp2;
    /* for alarm's week checking by chip, MMI needs to get a special week day,
        according to the week day of MMI_START_YEAR's 1/1. That day's week day should be 0 */
    //d = (d + 1) % 7;
    /* normal week day should be d = d % 7;*/
    d %= 7;
    return d;
}
阅读(1010) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~