diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2014-11-24 18:32:44 +0100 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2014-11-24 18:32:44 +0100 |
commit | c3b0894f7d25a397aa7ec9af9c9afcbe129ae4fa (patch) | |
tree | b4b0b1798abafecf8706ab9129845f9e424c9d36 /storage | |
parent | c89b8a38de20c00bb6d9d822f7f027ce9fcf51d8 (diff) | |
download | mariadb-git-c3b0894f7d25a397aa7ec9af9c9afcbe129ae4fa.tar.gz |
- Make the fix for getting day names of dates more general
modified:
storage/connect/ha_connect.cc
storage/connect/value.cpp
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/ha_connect.cc | 2 | ||||
-rw-r--r-- | storage/connect/value.cpp | 15 |
2 files changed, 7 insertions, 10 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 957c28abd28..ae8f7f0efa8 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -1326,7 +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 + mktime(&datm); // set other fields get proper day name len= strftime(buf, 256, pdtp->OutFmt, &datm); } else len= 0; diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index 11793a7b141..0f2cf0ee936 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -2190,7 +2190,8 @@ static void TIME_to_localtime(struct tm *tm, const MYSQL_TIME *ltime) tm->tm_hour= ltime->hour; tm->tm_min= ltime->minute; 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 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, <ime, (my_time_t) *timep); TIME_to_localtime(tm, <ime); return tm; -} +} // end of gmtime_mysql /***********************************************************************/ /* GetGmTime: returns a pointer to a static tm structure obtained */ @@ -2484,10 +2485,8 @@ char *DTVAL::GetCharString(char *p) size_t n = 0; struct tm tm, *ptm= GetGmTime(&tm); - if (ptm) { - mktime(ptm); // Populate tm_wday and tm_yday to get day name + if (ptm) n = strftime(Sdate, Len + 1, Pdtp->OutFmt, ptm); - } // endif ptm if (!n) { *Sdate = '\0'; @@ -2524,10 +2523,8 @@ char *DTVAL::ShowValue(char *buf, int len) m = Len + 1; } // endif Len - if (ptm) { - mktime(ptm); // Populate tm_wday and tm_yday to get day name + if (ptm) n = strftime(p, m, Pdtp->OutFmt, ptm); - } // endif ptm if (!n) { *p = '\0'; @@ -2602,7 +2599,7 @@ bool DTVAL::WeekNum(PGLOBAL g, int& nval) /***********************************************************************/ bool DTVAL::FormatValue(PVAL vp, char *fmt) { - char *buf = (char*)vp->GetTo_Val(); // Should be big enough + char *buf = (char*)vp->GetTo_Val(); // Should be big enough struct tm tm, *ptm = GetGmTime(&tm); if (trace > 1) |