| 314 | #define USE_TIME_DAYLIGHT 1 |
| 315 | |
| 316 | void rfc822::mkdate_cst(time_t t, char *buf, size_t size) |
| 317 | { |
| 318 | long offset = 0; |
| 319 | struct tm tm_buf; |
| 320 | struct tm *p = acl_localtime_r(&t, &tm_buf); |
| 321 | |
| 322 | buf[0] = 0; |
| 323 | |
| 324 | if (p == NULL) { |
| 325 | return; |
| 326 | } |
| 327 | |
| 328 | #if USE_TIME_ALTZONE |
| 329 | |
| 330 | offset = -_timezone; |
| 331 | |
| 332 | if (p->tm_isdst > 0) { |
| 333 | offset = -altzone; |
| 334 | } |
| 335 | |
| 336 | if (offset % 60) { |
| 337 | offset = 0; |
| 338 | #ifdef ACL_WINDOWS |
| 339 | # if _MSC_VER >= 1500 |
| 340 | p = &tm_buf; |
| 341 | if (gmtime_s(p, &t) != 0) { |
| 342 | p = NULL; |
| 343 | } |
| 344 | # else |
| 345 | p = gmtime(&t); |
| 346 | # endif |
| 347 | #else |
| 348 | p = gmtime_r(&t, &tm_buf); |
| 349 | #endif |
| 350 | } |
| 351 | offset /= 60; |
| 352 | #else |
| 353 | #if USE_TIME_DAYLIGHT |
| 354 | |
| 355 | #ifdef ACL_WINDOWS |
| 356 | # if _MSC_VER >= 1500 |
| 357 | long s; |
| 358 | if ( _get_timezone(&s) != 0) { |
| 359 | s = 0; |
| 360 | } |
| 361 | offset =- s; |
| 362 | # else |
| 363 | offset = - _timezone; |
| 364 | # endif |
| 365 | #elif !defined(ACL_FREEBSD) && !defined(MINGW) // XXX -zsx |
| 366 | offset = - timezone; |
| 367 | #endif |
| 368 | |
| 369 | if (p == NULL) { |
| 370 | return; |
| 371 | } |
| 372 | |
| 373 | if (p->tm_isdst > 0) { |
no test coverage detected