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; }
public SharpDiscordianDate(DateTime NonNormalDateTime) { hastur = MakeDay(NonNormalDateTime.Month, NonNormalDateTime.Day, NonNormalDateTime.Year); }
public SharpDiscordianDate() { hastur = MakeDay(DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Year); }
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; }