能力值:
( LV2,RANK:10 )
|
-
-
2 楼
及时雨,我正需要,支持……
|
能力值:
( LV2,RANK:10 )
|
-
-
3 楼
有点故障,完善修改如下:
void zxptime::GetTime70(UINT tt,int timea)
{
UINT myear,mday,oday;
UINT msec;
UINT ttmonth[12]={
31,28,31,30,31,30,
31,31,30,31,30,31
};
tt+=(timea*3600);
mday=tt/(24*3600);
idayvale=mday;
msec=tt-mday*(24*3600);
myear=mday/365;
oday=mday-myear*365-(myear+1)/4;
int y, i=0;
UINT iimoth;
y=(1970+myear);
iimoth=((y%4==0)&&(y%100!=0))||(y%400==0);
for(i=0;i<12;i++)
{
if((y=oday-ttmonth[i])>=0)
oday-=ttmonth[i]+(i==1?iimoth:0);
else
break;
}
iday=oday+1;
imonth=i+1;
iyear=1970+myear;
ihour=msec/3600;
imin=(msec-ihour*3600)/60;
isec=msec%60;
};
void zxptime::GetTime900(UINT tt,int timea)
{
UINT myear,mday,oday;
UINT msec;
UINT ttmonth[12]={
31,28,31,30,31,30,
31,31,30,31,30,31
};
tt+=(timea*3600);// 中国8时区
mday=tt/(24*3600);
idayvale=mday-(70*365)-70/4;
msec=tt-mday*(24*3600);
myear=mday/365;
oday=mday-myear*365-(myear)/4;
int y, i=0;
UINT iimoth;
y=(1900+myear);
iimoth=((y%4==0)&&(y%100!=0))||(y%400==0);
for(i=0;i<12;i++)
{
if((y=oday-ttmonth[i])>=0)
oday-=ttmonth[i]+(i==1?iimoth:0);
else
break;
}
iday=oday+1;
imonth=i+1;
iyear=1900+myear;
ihour=msec/3600;
imin=(msec-ihour*3600)/60;
isec=msec%60;
};
|
能力值:
( LV2,RANK:10 )
|
-
-
4 楼
以前的代码每月1日会出问题,修改后的就没有这个问题了。
|
能力值:
(RANK:1010 )
|
-
-
5 楼
回想当初开始练习写程序的时候,算法之类的没什么问题,最怕的就是时间转化的问题,闰年闰月的,搞不清楚,这大概是脑子里无法修正的BUG
|
|
|