Пример #1
0
        public DiscordianDate MakeDay(int imonth, int iday, int iyear)
        {
            DiscordianDate Output = new DiscordianDate();

            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;

             if ((imonth == 2) && (iday == 29))
                Output.StTibsDay = true;
            else
                Output.StTibsDay = false;

            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;
        }
Пример #2
0
 public SharpDiscordianDate(DateTime NonNormalDateTime)
 {
     hastur = MakeDay(NonNormalDateTime.Month, NonNormalDateTime.Day, NonNormalDateTime.Year);
 }
Пример #3
0
 public SharpDiscordianDate()
 {
     hastur = MakeDay(DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Year);
 }
Пример #4
0
        private DiscordianDate Convert(int nday, int nyear)
        {
            DiscordianDate Output = new DiscordianDate();

            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;
        }