Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- Realm
- vuepress
- error
- log
- C
- fabic
- 스트리밍
- bigquery
- fabric-sdk-java
- Gradle
- test
- LAYER_TYPE_SOFTWARE
- web3js
- quick-start
- hardwareacceleration
- firebase
- coroutines
- ethereum
- Glide
- 다윈
- convert
- dataginding
- Hyperledger
- null safety
- kotlin
- 안드로이드
- Android
- porterduff
- 컴파일
- Exception
Archives
- Today
- Total
날마다 새롭게 또 날마다 새롭게
day_of_year, month_of_year : 함수 구현 코드 본문
static char daytab[2][13] = {
{0,31,28,31,30,31,30,31,31,30,31,30,31},
{0,31,29,31,30,31,30,31,31,30,31,30,31}
};
/* day_of_year : set day of year from month & day */
int day_of_year(int year, int month, int day)
{
int i, leap;
leap = ((year%4==0)&&(year%100!=0))||year%400==0;
for(i=0;i<month;i++)
day += daytab[leap][i];
return day;
}
/* month_of_year : set month, day from day of year */
void month_day(int year, int yearday, int *pmonth, int *pday)
{
int i, leap;
leap = ((year%4==0)&&(year%100!=0))||year%400==0;
for(i=0;yearday > daytab[leap][i]; i++)
yearday -= daytab[leap][i];
*pmonth = i;
*pday = yearday;
}
Comments