Fix Windows strptime

This fixes the datetime-related tests in testAddition and testSubtraction in the LedgerMathTests
This commit is contained in:
Evan Mallory 2016-10-02 20:11:22 -04:00
parent cd58d43228
commit 441cadead3

View file

@ -70,14 +70,14 @@ static char* _strptime(const char *s, const char *format, struct tm *tm) {
case 'A':
tm->tm_wday = -1;
for (int i = 0; i < 7; ++i) {
len = static_cast<int>(strlen(kWeekAbbr[i]));
if (strnicmp(kWeekAbbr[i], s, len) == 0) {
len = static_cast<int>(strlen(kWeekFull[i]));
if (strnicmp(kWeekFull[i], s, len) == 0) {
tm->tm_wday = i;
break;
}
len = static_cast<int>(strlen(kWeekFull[i]));
if (strnicmp(kWeekFull[i], s, len) == 0) {
len = static_cast<int>(strlen(kWeekAbbr[i]));
if (strnicmp(kWeekAbbr[i], s, len) == 0) {
tm->tm_wday = i;
break;
}
@ -92,14 +92,14 @@ static char* _strptime(const char *s, const char *format, struct tm *tm) {
case 'h':
tm->tm_mon = -1;
for (int i = 0; i < 12; ++i) {
len = static_cast<int>(strlen(kMonthAbbr[i]));
if (strnicmp(kMonthAbbr[i], s, len) == 0) {
len = static_cast<int>(strlen(kMonthFull[i]));
if (strnicmp(kMonthFull[i], s, len) == 0) {
tm->tm_mon = i;
break;
}
len = static_cast<int>(strlen(kMonthFull[i]));
if (strnicmp(kMonthFull[i], s, len) == 0) {
len = static_cast<int>(strlen(kMonthAbbr[i]));
if (strnicmp(kMonthAbbr[i], s, len) == 0) {
tm->tm_mon = i;
break;
}