This section of code just doesn't seem to work for me. It skips the if block (in bold) when I know the statement is true.
Code:
double convert_to_julian(int *p_year, int *p_mon, int *p_day){
int a = 0, b = 0, c = 0, d = 0;
if(*p_mon == 1 || *p_mon == 2){
*p_year -= 1;
*p_mon += 12;
}
// At this point I know that year is 1994 month is 2 and day is 1
if((*p_year >= 1582) && (*p_mon >= OCT) && (*p_day >= 15)){
a = (*p_year / 100);
b = (2 - a) + (a / 4);
}
else{
b = 0;
}
.
.
.
But it does work if I remove the (*p_day >= 15) condition.
There must be something I'm forgetting
[edit]
omg I just realised my problem. sorry for wasting time.
the answer was this
Code:
if((*p_year > 1582) || (*p_year == 1582) && (*p_mon >= OCT) && (*p_day >= 15)){