MCPcopy Create free account
hub / github.com/MariaDB/server / GetGmTime

Method GetGmTime

storage/connect/value.cpp:2461–2480  ·  view source on GitHub ↗

/ GetGmTime: returns a pointer to a static tm structure obtained */ though the gmtime C function. The purpose of this function is to */ extend the range of valid dates by accepting negative time values. */ /

Source from the content-addressed store, hash-verified

2459/* extend the range of valid dates by accepting negative time values. */
2460/***********************************************************************/
2461struct tm *DTVAL::GetGmTime(struct tm *tm_buffer)
2462{
2463 struct tm *datm;
2464 time_t t = (time_t)Tval;
2465
2466 if (Tval < 0) {
2467 longlong n;
2468 for (n = 0; t < 0; n += 4)
2469 t += FOURYEARS;
2470
2471 datm = gmtime_mysql(&t, tm_buffer);
2472
2473 if (datm)
2474 datm->tm_year -= (int) n;
2475
2476 } else
2477 datm = gmtime_mysql(&t, tm_buffer);
2478
2479 return datm;
2480} // end of GetGmTime
2481
2482// Added by Alexander Barkov
2483static time_t mktime_mysql(struct tm *ptm)

Callers 1

WriteColumnMethod · 0.80

Calls 1

gmtime_mysqlFunction · 0.85

Tested by

no test coverage detected