Created
April 11, 2016 02:57
-
-
Save w4096/1fdcb6c8b9d9b509dc68e7ae83d4fc43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int CDate::operator-(const CDate d)const{ | |
int days; | |
int nm = (_Month + 9) % 12; // | |
int ny = _Year - nm / 10; | |
int nd = 365 * ny + ny / 4 - ny / 100 + ny / 400 + (nm * 306 + 5) / 10 + (_Day - 1); | |
int nm1 = (d._Month + 9) % 12; | |
int ny1 = d._Year - nm1 / 10; | |
int nd1 = 365 * ny1 + ny1 / 4 - ny1 / 100 + ny1 / 400 + (nm1 * 365 + 5) / 10 + (d._Day - 1); | |
days = nd - nd1; | |
return days; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment