Commit 6211708a authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix a bug causing the day always printed as Sunday for date columns with

  a date format specifying DDD or DDDD.
modified:
  storage/connect/ha_connect.cc
  storage/connect/value.cpp
parent b2db891c
......@@ -1326,6 +1326,7 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
datm.tm_mday= 12;
datm.tm_mon= 11;
datm.tm_year= 112;
mktime(&datm); // to get proper day name
len= strftime(buf, 256, pdtp->OutFmt, &datm);
} else
len= 0;
......
......@@ -2484,8 +2484,10 @@ char *DTVAL::GetCharString(char *p)
size_t n = 0;
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);
} // endif ptm
if (!n) {
*Sdate = '\0';
......@@ -2512,6 +2514,8 @@ char *DTVAL::ShowValue(char *buf, int len)
size_t m, n = 0;
struct tm tm, *ptm = GetGmTime(&tm);
if (Len < len) {
p = buf;
m = len;
......@@ -2520,8 +2524,10 @@ char *DTVAL::ShowValue(char *buf, int len)
m = Len + 1;
} // 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);
} // endif ptm
if (!n) {
*p = '\0';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment