* NAME: calctzdiff() * DESCRIPTION: calculate the timezone difference between local time and UTC */
| 430 | * DESCRIPTION: calculate the timezone difference between local time and UTC |
| 431 | */ |
| 432 | static |
| 433 | void calctzdiff(void) |
| 434 | { |
| 435 | # ifdef HAVE_MKTIME |
| 436 | |
| 437 | time_t t; |
| 438 | int isdst; |
| 439 | struct tm tm; |
| 440 | const struct tm *tmp; |
| 441 | |
| 442 | time(&t); |
| 443 | isdst = localtime(&t)->tm_isdst; |
| 444 | |
| 445 | tmp = gmtime(&t); |
| 446 | if (tmp) |
| 447 | { |
| 448 | tm = *tmp; |
| 449 | tm.tm_isdst = isdst; |
| 450 | |
| 451 | tzdiff = t - mktime(&tm); |
| 452 | } |
| 453 | else |
| 454 | tzdiff = 0; |
| 455 | |
| 456 | # else |
| 457 | |
| 458 | tzdiff = 0; |
| 459 | |
| 460 | # endif |
| 461 | } |
| 462 | |
| 463 | /* |
| 464 | * NAME: data->ltime() |