| 311 | } |
| 312 | |
| 313 | void TestGmTimeR(time_t starttime, time_t finishtime, int steps) { |
| 314 | time_t step = (finishtime - starttime) / steps; |
| 315 | struct tm tms0, tms1; |
| 316 | struct tm* ptm0 = nullptr; |
| 317 | struct tm* ptm1 = nullptr; |
| 318 | for (time_t t = starttime; t < finishtime; t += step) { |
| 319 | ptm0 = GmTimeR(&t, &tms0); |
| 320 | UNIT_ASSERT_EQUAL(ptm0, &tms0); |
| 321 | |
| 322 | #ifdef _win_ |
| 323 | if (tms0.tm_year + 1900 > 3000) { |
| 324 | // Windows: _MAX__TIME64_T == 23:59:59. 12/31/3000 UTC |
| 325 | continue; |
| 326 | } |
| 327 | #endif |
| 328 | |
| 329 | ptm1 = gmtime_r(&t, &tms1); |
| 330 | if (!ptm1) { |
| 331 | continue; |
| 332 | } |
| 333 | UNIT_ASSERT_EQUAL(ptm1, &tms1); |
| 334 | UNIT_ASSERT(CompareTMFull(ptm0, ptm1)); |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | Y_UNIT_TEST(TestGmTimeRLongRange) { |
| 339 | time_t starttime = static_cast<time_t>(-86397839500LL); // 29-Jan-2668 B.C. |
no test coverage detected