1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

Reformat all code to coding standard

This commit is contained in:
Andrew Hutchings
2017-10-26 17:18:17 +01:00
parent 4985f3456e
commit 01446d1e22
1296 changed files with 403852 additions and 353747 deletions

View File

@ -38,69 +38,73 @@ namespace joblist
{
JSTimeStamp::JSTimeStamp() :
fFirstInsertTime(zerotime),
fLastInsertTime(zerotime),
fEndofInputTime(zerotime),
fFirstReadTime(zerotime),
fLastReadTime(zerotime)
fFirstInsertTime(zerotime),
fLastInsertTime(zerotime),
fEndofInputTime(zerotime),
fFirstReadTime(zerotime),
fLastReadTime(zerotime)
{
}
/* static */
const string JSTimeStamp::format(const struct timeval& tvbuf)
{
string res;
char timeString[50];
struct tm tmbuf;
string res;
char timeString[50];
struct tm tmbuf;
#ifdef _MSC_VER
errno_t p = 0;
time_t t = tvbuf.tv_sec;
p = localtime_s(&tmbuf, &t);
if (p != 0)
{
memset(&tmbuf, 0, sizeof(tmbuf));
strcpy(timeString, "UNKNOWN");
}
else
{
if (strftime(timeString, 50, "%Y-%m-%d %H:%M:%S", &tmbuf) == 0)
strcpy(timeString, "UNKNOWN");
}
errno_t p = 0;
time_t t = tvbuf.tv_sec;
p = localtime_s(&tmbuf, &t);
if (p != 0)
{
memset(&tmbuf, 0, sizeof(tmbuf));
strcpy(timeString, "UNKNOWN");
}
else
{
if (strftime(timeString, 50, "%Y-%m-%d %H:%M:%S", &tmbuf) == 0)
strcpy(timeString, "UNKNOWN");
}
#else
localtime_r(&tvbuf.tv_sec, &tmbuf);
strftime(timeString, 50, "%F %T", &tmbuf);
localtime_r(&tvbuf.tv_sec, &tmbuf);
strftime(timeString, 50, "%F %T", &tmbuf);
#endif
const int len = strlen(timeString);
snprintf(&timeString[len], (50-len), ".%06lu", tvbuf.tv_usec);
res = timeString;
return res;
const int len = strlen(timeString);
snprintf(&timeString[len], (50 - len), ".%06lu", tvbuf.tv_usec);
res = timeString;
return res;
}
/* static */
const string JSTimeStamp::tsdiffstr(const struct timeval& t2, const struct timeval& t1)
{
string res;
int ds;
int dus;
char timeString[50];
dus = t2.tv_usec - t1.tv_usec;
ds = t2.tv_sec - t1.tv_sec;
if (dus < 0)
{
ds--;
dus += 1000000;
}
snprintf(timeString, 50, "%d.%06d", ds, dus);
res = timeString;
return res;
string res;
int ds;
int dus;
char timeString[50];
dus = t2.tv_usec - t1.tv_usec;
ds = t2.tv_sec - t1.tv_sec;
if (dus < 0)
{
ds--;
dus += 1000000;
}
snprintf(timeString, 50, "%d.%06d", ds, dus);
res = timeString;
return res;
}
/* static */
const string JSTimeStamp::timeNow()
{
struct timeval tv;
gettimeofday(&tv, 0);
return JSTimeStamp::format(tv);
struct timeval tv;
gettimeofday(&tv, 0);
return JSTimeStamp::format(tv);
}
} //namespace joblist