/* SDATE.BZ, copyright (c) 9452.23 Stig Johansen */ // 3.33 How patch by Perttu Laine / Silver Ice. int leap(int year) { if ((year%4==0&&year%100!=0)||year%400==0) { return(1); } else { return(0); } } int days(int year, int month, int day) { int tmp; tmp=0; switch (month) { case 2: { tmp=31; break; } case 3: { tmp=31+28+leap(year); break; } case 4: { tmp=31+28+leap(year)+31; break; } case 5: { tmp=31+28+leap(year)+31+30; break; } case 6: { tmp=31+28+leap(year)+31+30+31; break; } case 7: { tmp=31+28+leap(year)+31+30+31+30; break; } case 8: { tmp=31+28+leap(year)+31+30+31+30+31; break; } case 9: { tmp=31+28+leap(year)+31+30+31+30+31+31; break; } case 10: { tmp=31+28+leap(year)+31+30+31+30+31+31+30; break; } case 11: { tmp=31+28+leap(year)+31+30+31+30+31+31+30+31; break; } case 12: { tmp=31+28+leap(year)+31+30+31+30+31+31+30+31+30; break; } } return(day+tmp); } int main() { int tmp, tst1, tst2; char months; months[ 0]="Illegal Month"; months[ 1]="January"; months[ 2]="February"; months[ 3]="March"; months[ 4]="April"; months[ 5]="May"; months[ 6]="June"; months[ 7]="July"; months[ 8]="August"; months[ 9]="September"; months[10]="October"; months[11]="November"; months[12]="December"; tmp=100000*bf_min; tmp=tmp/60; tmp=tmp+(100000*bf_hour); tmp=tmp/24; tmp=tmp+(100000*(days(bf_year,bf_month,bf_day))); tmp=tmp-100000; tmp=tmp/(365+leap(bf_year)); tmp=tmp+(100000*bf_year); tmp=tmp-190000000; tst1=tmp/1000; tst2=(tmp%1000)/10; printf("\e[1;37mToday's Date and Time are: \e[33m%02u %s %u %02u:%02u:%02u\n", bf_day,months[bf_month],bf_year,bf_hour,bf_min,bf_sec); printf("\e[0;36mToday's StarDate is \e[1m%i.%i\e[0m\n",tst1,tst2); }