string_to_datetime and y2k problem
----------------------------------
Key: CORE-6495
URL: http://tracker.firebirdsql.org/browse/CORE-6495
Project: Firebird Core
Issue Type: Bug
Components: Engine
Affects Versions: 3.0.8
Reporter: Kovalenko Dmitry
Priority: Minor
string_to_datetime has following code for correction of y2k problem (two-digit
year):
tm times2;
Firebird::TimeStamp::getCurrentTimeStamp().decode(×2);
// Handle defaulting of year
if (description[position_year] == 0) {
times.tm_year = times2.tm_year + 1900;
}
else if (description[position_year] <= 2)
{
// Handle conversion of 2-digit years
if (times.tm_year < (times2.tm_year - 50) % 100)
times.tm_year += 2000;
else
times.tm_year += 1900;
}
times.tm_year -= 1900;
times.tm_mon -= 1;
---
This code looks to the CURRENT year, but adjust the two-digit year number on
1900 or 2000.
When current year will be more than 2050, this code will return strange result.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel