Beispiel #1
0
        public DiscordianDateStructure MakeDay(int imonth, int iday, int iyear)
        {
            DiscordianDateStructure Output = new DiscordianDateStructure();

            int[,] cal = new int[2, 12]
            {
                {31,28,31,30,31,30,31,31,30,31,30,31},
                { 31,29,31,30,31,30,31,31,30,31,30,31}
            };

            int dayspast = 0;
            imonth--;
            Output.year = iyear + 1166;

            while (imonth > 0)
            {
                dayspast += cal[(Output.year % 4) == 2 ? 1 : 0, --imonth];

            }
            Output.day = dayspast + iday;
            Output.season = 0;

            if ((Output.year % 4) == 2)
            {
                if (Output.day == 59)
                    Output.day = -1;
                else
                    if (Output.day > 59)
                        Output.day -= 1;
            }

            Output.yday = Output.day;

            while (Output.day > 73)
            {
                Output.season++;
                Output.day -= 73;
            }

            return Output;
        }
Beispiel #2
0
        private DiscordianDateStructure Convert(int nday, int nyear)
        {
            DiscordianDateStructure Output = new DiscordianDateStructure();

            Output.year = nyear + 3066;
            Output.day = nday;
            Output.season = 0;

            if ((Output.year % 4) == 2)
            {
                if (Output.day == 59)
                    Output.day = -1;
                else
                    if (Output.day > 59)
                        Output.day -= 1;
            }
            Output.yday = Output.day;

            while (Output.day > 73)
            {
                Output.season++;
                Output.day -= 73;
            }
            return Output;
        }