/ 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. */ /
| 2459 | /* extend the range of valid dates by accepting negative time values. */ |
| 2460 | /***********************************************************************/ |
| 2461 | struct 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 |
| 2483 | static time_t mktime_mysql(struct tm *ptm) |
no test coverage detected