thanks, i was expecting something like that, but i still need a screwed up model of counting months, based on days, shouldn't be a problem except very annoying.
Anyway i worked out the leapyear problem by drawing some diagrams and banging my head against the wall a couple of times.
the whole thing got clear when i realized the first gap on a year shouldn't be smaller than the gap for the absolute year and last day. I'm still wondering if i should have Years starting at 0 or 1 since Day starts on 1.Code:Year=Time/Sun; X=Time%Planet; //Time Since Midnight Day=((Time%=Sun)+Planet-X)/Planet; //Time gets relative to NewYear, Convert to day after adding the rest of the day. if (!Day){ //Day belongs to last year Day=Sun/Planet+((X-Time)<(Sun%Planet)); //Last day of last year + possible leapyear, which happens when the gap between Year--; //Last day and current year is smaller than the gap between first year's last day } //and Second year.





Reply With Quote