-
Notifications
You must be signed in to change notification settings - Fork 134
[CBRD-26457] Fixed an issue where adddate() and subdate() results would be inaccurate when a leap year was included #6728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…ld be inaccurate when a leap year was included
|
/run all |
| { | ||
| _d = 1; | ||
| _y--; | ||
| _m = (_m == 1) ? 12 : (_m - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_d가 0인 경우는 /* days within a year */ 루프 전부터 _d = 0인 경우밖에 없을 것 같습니다.
해당 경우엔 항상 _y--; _m = 12; 일 것 같습니다.
| { | ||
| _d += days[i]; | ||
| } | ||
| _m = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이슈와 별개로 해당 부분을 삭제할 수 있을 거 같습니다.
| _m = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
19693 라인의 goto 문에서 19722 라인을 거쳐 19730 라인에서 _m 을 사용하기 때문에 삭제할 수 없을 것 같습니다.
19693 라인에서 언제나 _m 이 1 이라고 볼 수 없을 것 같습니다.
단, 18700 라인의 for 문에서 _m = 1 은 지울 수 있을 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
19693라인의 goto 문을 통했을 때, 19730 라인을 갈 수 있나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컴파일러가 최적화 과정에서 for 문의 _m = 1 을 삭제할 수는 있겠지만,
readability 를 위해서 생략하지 않는 것이 좋겠습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kangmin5505 갈 수 있지요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_m = 1; 를 goto set_and_return; 앞으로 옮기도록 하겠습니다.
이렇게 되면 가독성 문제도 해결 되고, 기존과 동일한 결과도 기대할 수 있겠네요
그런데 이 경우에는 어차피 에러를 리턴하고 _m은 사용되지 않는군요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
goto 직전 검사하는 조건을 볼 때 19730 라인을 갈 수 없다는 것을 알게 되었습니다.
혼란을 드려 죄송합니다.
|
본 이슈를 리뷰하면서 발견한 오류가 있습니다. add date 기능이지만 argument로 음수가 넘어왔을 때 처리가 제대로 안 되고 있습니다. |
m 이 음수인 경우는 sub_and_normalize_date_time() 를 타고 실행되는 것 같습니다. |
|
http://jira.cubrid.org/browse/CBRD-26457
Purpose
Implementation
N/A
Remarks
N/A