سلام دوستان

من اين دو تا فايل رو با كلي سرچ پيدا كردم. Date.h رو با كمي تغيير روي آردينو آپلود كردم اما خروجي غلط ميده.

اون يكي كد رو هم نميدونم چجوري بايد استفاده كرد. كسي راهه ديگه اي بلد نيست ؟ ( براي آردوينو به زبان C )


####

متاسفانه نميزاره من فايل آپلود كنم كدش رو همينجا مينويسم واستون :

Date.h

کد:
#include<math.h> //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Input : Milady(iYaer,iMonth,iDay) // Output : Shamsy(Yaer,Month,Day) //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void Milady2Shamsy(int iYear , int iMonth , int iDay , int *Year , int *Month , int *Day) { int jdn,jdn2,depoch,cycle,cyear,ycycle,aux1, aux2,yday; int epbase,epyear,mdays; const int PERSIAN_EPOCH = 1948321 ; if((iYear > 1582) || ((iYear == 1582) && (iMonth > 10)) || ((iYear == 1582) && (iMonth == 10) && (iDay > 14))) jdn = ((1461*(iYear+4800+((iMonth-14) / 12))) / 4)+((367*(iMonth-2-12*(((iMonth-14) / 12)))) / 12)-((3*(((iYear+4900+((iMonth-14) / 12)) / 100))) / 4)+iDay-32075; else jdn = 367 * iYear - ((7 * (iYear + 5001 + ((iMonth - 9) / 7))) / 4) + ((275 * iMonth) / 9) + iDay + 1729777; epbase = 475-474; epyear = 474 + (fmod(epbase , 2820)) ; mdays = (1 - 1) * 31 ; jdn2 = 1+mdays+ floor(((epyear*682)-110)/ 2816)+(epyear-1)*365+floor(epbase / 2820)*1029983+(PERSIAN_EPOCH-1); depoch = jdn-jdn2; cycle = floor(depoch / 1029983); cyear = fmod(depoch , 1029983) ; if(cyear == 1029982) ycycle = 2820; else { aux1 = floor(cyear / 366); aux2 = fmod(cyear , 366); ycycle = (((2134*aux1)+(2816*aux2)+2815) / 1028522)+aux1+1; } iYear = ycycle + (2820*cycle) + 474; if(iYear <= 0) iYear = iYear-1; if(iYear >= 0) epbase = iYear-474; else epbase = iYear-473; epyear = 474 + fmod(epbase , 2820); mdays = (1-1)*31; jdn2 = 1+mdays+floor(((epyear*682)-110)/ 2816)+(epyear-1)*365 + floor(epbase / 2820)*1029983+(PERSIAN_EPOCH-1); yday = (jdn-jdn2)+1; if(yday <= 186) { if(yday < 0) iMonth = (-abs(yday / 31)); else if(yday > 0) iMonth = -1 * (-abs(yday / 31)); else iMonth = 0; } else { if((yday - 6) < 0) iMonth = (-abs((yday - 6) / 30)); else if((yday - 6) > 0) iMonth = -1 * (-abs((yday - 6) / 30)); else iMonth = 0; //iMonth = -sign(((yday - 6) / 30)) * (-abs((yday - 6) / 30)); } if(iYear >= 0) epbase = iYear-474; else epbase = iYear-473; epyear = 474 + fmod(epbase , 2820); if(iMonth <= 7) mdays = (iMonth-1)*31; else mdays = (iMonth-1)*30+6; jdn2 = 1 + mdays + floor(((epyear*682)-110) / 2816) + (epyear-1)*365 + floor(epbase / 2820)*1029983 + (PERSIAN_EPOCH - 1); iDay = (jdn - jdn2) + 1; //aa:=inttostr(iYear)+'/'+inttostr(iMonth)+'/'+inttostr(iDay); if(iMonth < 7) while(iDay > 31) { iMonth++; iDay -= 31; } else while(iDay > 30) { iMonth++; iDay -= 30; } *Year = iYear; *Month = iMonth; *Day = iDay; }