Traditional Culture Encyclopedia - Almanac inquiry - Google yearbook

Google yearbook

Structural transformation

{

Int source;

int SolarYear

int SolarMonth

int SolarDate

Lunar calendar room;

During the lunar month;

int LunarDate

Int working days;

int Kan

int Chih

};

unsigned _ _ int 64m _ ui 64 solar terms[24];

unsigned _ _ int 64m _ ui64 month days[ 13];

m _ ui64 month days[0]= 0ui 64;

m _ ui64 month days[ 1]= 3 1ui 64;

m _ ui64 month days[2]= 28ui 64;

m _ ui64 month days[3]= 3 1ui 64;

m _ ui64 month days[4]= 30ui 64;

m _ ui64 month days[5]= 3 1ui 64;

m _ ui64 month days[6]= 30ui 64;

m _ ui64 month days[7]= 3 1ui 64;

m _ ui64 month days[8]= 3 1ui 64;

m _ ui64 month days[9]= 30ui 64;

m _ ui64 month days[ 10]= 3 1ui 64;

m _ ui 64 month days[ 1 1]= 30ui 64;

m _ ui64 month days[ 12]= 3 1ui 64;

m _ ui 64 solarterms[0]= 0ui 64;

m _ ui 64 solarterms[ 1]= 2 1208 ui 64;

m _ ui 64 solarterms[2]= 42467 ui 64;

m _ ui 64 solarterms[3]= 63836 ui 64;

m _ ui 64 solarterms[4]= 85337 ui 64;

m _ ui 64 solarterms[5]= 1070 14ui 64;

m _ ui 64 solarterms[6]= 128867 ui 64;

m _ ui 64 solarterms[7]= 15092 1ui 64;

m _ ui 64 solarterms[8]= 173 149 ui 64;

m _ ui 64 solarterms[9]= 19555 1ui 64;

m _ ui 64 solarterms[ 10]= 2 18072 ui 64;

m _ ui 64 solarterms[ 1 1]= 240693 ui 64;

m _ ui 64 solarterms[ 12]= 263343 ui 64;

m _ ui 64 solarterms[ 13]= 285989 ui 64;

m _ ui 64 solarterms[ 14]= 308563 ui 64;

m _ ui 64 solarterms[ 15]= 33 1033 ui 64;

m _ ui 64 solarterms[ 16]= 353350 ui 64;

m _ ui 64 solarterms[ 17]= 375494 ui 64;

m _ ui 64 solarterms[ 18]= 397447 ui 64;

m _ ui 64 solarterms[ 19]= 4 192 10ui 64;

m _ ui 64 solarterms[20]= 440795 ui 64;

m _ ui 64 solarterms[2 1]= 462224 ui 64;

m _ ui 64 solarterms[22]= 483532 ui 64;

m _ ui 64 solarterms[23]= 504758 ui 64;

/* 24 solar terms calculation */

int _ _ fast call is leapy year(int iYear)

{

If ((iYear & amp3)! = 0)

{

Returns 0;

}

else if (iYear % 100! = 0)

{

Returns1;

}

else if (iYear % 400 == 0)

{

Returns1;

}

other

{

Returns 0;

}

}

int _ _ fast call TheSolarTerm(int iYear,int n)

{

Unsigned _ _ int 64k;;

unsigned _ _ int 64 ddate _ utc = 22085493000000 ui 64;

unsigned __int64 doffdate,dadddate

doff date = m _ ui 64 solarterms[n]* 600000 ui 64;

doff date+= static _ cast & lt; unsigned _ _ int64 & gt(iYear- 1900)* 3 15569259747 ui 64;

doff date-= ddate _ utc;

doff date/= 864000000 ui 64; //86400: 60 * 60 * 24 * 1000

int I = 1969;

dadddate = 0ui64

while(dadddate & lt; doffdate)

{

i++;

k = dadddate

dadd date+= 365 ui 64+static _ cast & lt; unsigned _ _ int64 & gt(IsLeapYear(I));

};

if(dadddate & gt; doffdate)

{

int j = 0;

dadd date = k;

while(dadddate & lt; doffdate & amp& ampj & lt 12)

{

j++;

k = dadddate

dadd date+= m _ ui 64 month days[j];

if(j = = 2 & amp; & amp(IsLeapYear (me)! = 0))

{

dadd date++;

}

};

Return static _ cast & ltint & gt (doffer date-k+1ui64);

}

else // j = doffdate

{

Returns1;

}

}

int CalConv(struct ConvDate & amp; Optical disc)

{

int leap,d,sm,y,im,l 1,l2,acc,I,lm,KC;

If (cd. Source == 0) /* Solar */

{

If (cd. SolarYear & lt= first year || cd. SolarYear & gt last year)

{

Returns1;

}

sm = cd。 solar month- 1;

if(sm & lt; 0 | | sm & gt 1 1)

{

return 2;

}

leap = GetLeap(cd。 solar year);

d = (sm == 1)? (leap+28): solarcal [sm];

If (cd. SolarDate & lt 1 || cd。 SolarDate & gtd)

{

Return to 3;

}

y = cd。 SolarYear-the first year;

acc = SolarDays[leap][sm] + cd。 SolarDate

CD. Weekday = (acc + LunarCal[y])。 base weekday)% 7;

kc = acc + LunarCal[y]。 BaseKanChih

CD. Kan = KC % 10;

CD. chih = KC % 12;

if(ACC & lt; = LunarCal[y]。 Base date)

{

y-;

CD. LunarYear = cd。 solary ear- 1;

leap = GetLeap(cd。 lunar year);

sm+= 12;

acc = SolarDays[leap][sm] + cd。 SolarDate

}

other

{

CD. LunarYear = cd。 SolarYear

}

l 1 = LunarCal[y]。 Base date;

for(I = 0; I< 13; i++)

{

l2 = l 1 + LunarCal[y]。 month days[I]+29;

if(ACC & lt; = l2)

{

Break;

}

l 1 = L2;

}

CD. lunar month = I+ 1;

CD. lunar date = ACC-l 1;

im = LunarCal[y]。 Intercalation;

If (im! = 0 & amp& amp CD. LunarMonth & gt instant message)

{

CD. lunar month-;

If (cd. LunarMonth == im)

{

CD. lunar month =-im;

}

}

If (cd. LunarMonth & gt 12)

{

CD. lunar month-= 12;

}

}

else /* Lunar */

{

If (cd. LunarYear & lt first year || cd. LunarYear & gt= last year)

{

Returns1;

}

y = cd。 Lunar New Year-the first year;

im = LunarCal[y]。 Intercalation;

lm = cd。 LunarMonth

if(lm & lt; 0)

{

If (lm! = -im)

{

return 2;

}

}

else if(lm & lt; 1 | | lm & gt; 12)

{

return 2;

}

If (im! = 0)

{

if(lm & gt; Instant message)

{

lm++;

}

else if (lm == -im)

{

lm = im+ 1;

}

}

lm-;

If (cd. LunarDate & gtLunarCal[y]。 Months [lm]+29)

{

Return to 3;

}

acc = LunarCal[y]。 Base date;

for(I = 0; I & ltlm;; i++)

{

acc += LunarCal[y]。 month days[I]+29;

}

acc += cd。 LunarDate

leap = GetLeap(cd。 lunar year);

for(I = 13; I>= 0; I-)

{

if(ACC & gt; Solar days[ leap ][i])

{

Break;

}

}

CD. solar date = ACC-solar days[leap][I];

If (I<= 1 1)

{

CD. SolarYear = cd。 LunarYear

CD. solar month = I+ 1;

}

other

{

CD. SolarYear = cd。 lunar year+ 1;

CD. solar month = I- 1 1;

}

leap = GetLeap(cd。 solar year);

y = cd。 SolarYear-the first year;

acc = SolarDays[leap][cd。 SolarMonth - 1] + cd。 SolarDate

CD. Weekday = (acc + LunarCal[y])。 base weekday)% 7;

kc = acc + LunarCal[y]。 BaseKanChih

CD. Kan = KC % 10;

CD. chih = KC % 12;

}

Returns 0;

}