ShiftTime
#1

I try to use this function:
Код:
stock ShiftTime(&y=0,&mo=1,&d=1,&h=0,&m=0,&s=0,sy=0,smo=0,sd=0,sh=0,sm=0,ss=0){
	new days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	s+=ss;
	m+=sm+(s/60);
	h+=sh+(m/60);
	d+=-1+sd+(h/24);
	mo+=smo-1;y+=sy+mo/12;mo%=12;
	if((!(y%4)&&(y%100))||!(y%400))days[1]=29;
	for(new i=sign(d);d/days[mo];d-=i*days[mo]){
		mo+=i;
		if(mo>11||mo<0){
			y+=i;if((!(y%4)&&(y%100))||!(y%400))days[1]=29;else days[1]=28;
		}mo%=12;
	}s%=60;m%=60;h%=24;mo+=1;d+=1;
}

stock sign({Float,_}:x){if(x>0)return 1;else if(x<0)return -1;return 0;}
I think that it is not working properly
i put this on my map and use like this:
Код:
if(ShiftTime(r,mo,d,g,m,s,0,0,0,0,1,0))
... (some code)
is it my fault?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)