RFC Errata
RFC 5260, "Sieve Email Filtering: Date and Index Extensions", July 2008
Source of RFC: IETF - NON WORKING GROUPSee Also: RFC 5260 w/ inline errata
Errata ID: 1836
Status: Verified
Type: Technical
Publication Format(s) : TEXT
Reported By: Ned Freed
Date Reported: 2009-08-22
Verifier Name: Alexey Melnikov
Date Verified: 2009-08-23
Section A says:
int jday(int year, int month, int day) { int j, c, ya; if (month > 2) month -= 3; else { month += 9; year--; } c = year / 100; ya = year - c * 100; return (c * 146097 / 4 + ya * 1461 / 4 + (month * 153 + 2) / 5 + day + 1721119); } void jdate(int j, int *year, int *month, int *day) { int y, m, d; j -= 1721119; y = (j * 4 - 1) / 146097; j = j * 4 - y * 146097 - 1; d = j / 4; j = (d * 4 + 3) / 1461; d = d * 4 - j * 1461 + 3; d = (d + 4) / 4; m = (d * 5 - 3) / 153; d = d * 5 - m * 153 - 3; *day = (d + 5) / 5; *year = y * 100 + j; if (m < 10) *month = m + 3; else { *month = m - 9; *year += 1; } }
It should say:
int jday(int year, int month, int day) { int c, ya; if (month > 2) month -= 3; else { month += 9; year--; } c = year / 100; ya = year - c * 100; return (c * 146097 / 4 + ya * 1461 / 4 + (month * 153 + 2) / 5 + day + (1721119 - 2400001)); } void jdate(int j, int *year, int *month, int *day) { int y, m, d; j -= (1721119 - 2400001); y = (j * 4 - 1) / 146097; j = j * 4 - y * 146097 - 1; d = j / 4; j = (d * 4 + 3) / 1461; d = d * 4 - j * 1461 + 3; d = (d + 4) / 4; m = (d * 5 - 3) / 153; d = d * 5 - m * 153 - 3; *day = (d + 5) / 5; *year = y * 100 + j; if (m < 10) *month = m + 3; else { *month = m - 9; *year += 1; } }
Notes:
The sample Julian day and date routines are coded to use regular Julian dates, not the modified Julian dates specified in the RFC. The above modification adds the necessary conversion factors for modified Julian days. An unused variable (j) was also removed.