1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

- Make the fix for getting day names of dates more general

modified:
  storage/connect/ha_connect.cc
  storage/connect/value.cpp
This commit is contained in:
Olivier Bertrand
2014-11-24 18:32:44 +01:00
parent c89b8a38de
commit c3b0894f7d
2 changed files with 7 additions and 10 deletions

View File

@@ -1326,7 +1326,7 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
datm.tm_mday= 12; datm.tm_mday= 12;
datm.tm_mon= 11; datm.tm_mon= 11;
datm.tm_year= 112; datm.tm_year= 112;
mktime(&datm); // to get proper day name mktime(&datm); // set other fields get proper day name
len= strftime(buf, 256, pdtp->OutFmt, &datm); len= strftime(buf, 256, pdtp->OutFmt, &datm);
} else } else
len= 0; len= 0;

View File

@@ -2190,7 +2190,8 @@ static void TIME_to_localtime(struct tm *tm, const MYSQL_TIME *ltime)
tm->tm_hour= ltime->hour; tm->tm_hour= ltime->hour;
tm->tm_min= ltime->minute; tm->tm_min= ltime->minute;
tm->tm_sec= ltime->second; tm->tm_sec= ltime->second;
} mktime(tm); // set other tm fields to get proper day name (OB)
} // end of TIME_to_localtime
// Added by Alexander Barkov // Added by Alexander Barkov
static struct tm *gmtime_mysql(const time_t *timep, struct tm *tm) static struct tm *gmtime_mysql(const time_t *timep, struct tm *tm)
@@ -2199,7 +2200,7 @@ static struct tm *gmtime_mysql(const time_t *timep, struct tm *tm)
thd_gmt_sec_to_TIME(current_thd, &ltime, (my_time_t) *timep); thd_gmt_sec_to_TIME(current_thd, &ltime, (my_time_t) *timep);
TIME_to_localtime(tm, &ltime); TIME_to_localtime(tm, &ltime);
return tm; return tm;
} } // end of gmtime_mysql
/***********************************************************************/ /***********************************************************************/
/* GetGmTime: returns a pointer to a static tm structure obtained */ /* GetGmTime: returns a pointer to a static tm structure obtained */
@@ -2484,10 +2485,8 @@ char *DTVAL::GetCharString(char *p)
size_t n = 0; size_t n = 0;
struct tm tm, *ptm= GetGmTime(&tm); struct tm tm, *ptm= GetGmTime(&tm);
if (ptm) { if (ptm)
mktime(ptm); // Populate tm_wday and tm_yday to get day name
n = strftime(Sdate, Len + 1, Pdtp->OutFmt, ptm); n = strftime(Sdate, Len + 1, Pdtp->OutFmt, ptm);
} // endif ptm
if (!n) { if (!n) {
*Sdate = '\0'; *Sdate = '\0';
@@ -2524,10 +2523,8 @@ char *DTVAL::ShowValue(char *buf, int len)
m = Len + 1; m = Len + 1;
} // endif Len } // endif Len
if (ptm) { if (ptm)
mktime(ptm); // Populate tm_wday and tm_yday to get day name
n = strftime(p, m, Pdtp->OutFmt, ptm); n = strftime(p, m, Pdtp->OutFmt, ptm);
} // endif ptm
if (!n) { if (!n) {
*p = '\0'; *p = '\0';