If A is the broken-down local time and B the broken-down UT for the same instant, return A's UT offset in seconds, where positive offsets are east of Greenwich. On failure, return LONG_MIN. If T is nonnull, *T is the timestamp that corresponds to A; call my_gmtime_r and use its result instead of B. Otherwise, B is the possibly nonnull result of an earlier call to my_gmtime_r. */
| 759 | my_gmtime_r and use its result instead of B. Otherwise, B is the |
| 760 | possibly nonnull result of an earlier call to my_gmtime_r. */ |
| 761 | static long |
| 762 | gmtoff(struct tm const *a, ATTRIBUTE_MAYBE_UNUSED time_t *t, |
| 763 | ATTRIBUTE_MAYBE_UNUSED struct tm const *b) |
| 764 | { |
| 765 | #ifdef TM_GMTOFF |
| 766 | return a->TM_GMTOFF; |
| 767 | #else |
| 768 | struct tm tm; |
| 769 | if (t) |
| 770 | b = my_gmtime_r(t, &tm); |
| 771 | if (! b) |
| 772 | return LONG_MIN; |
| 773 | else { |
| 774 | int ayday = adjusted_yday(a, b); |
| 775 | int byday = adjusted_yday(b, a); |
| 776 | int days = ayday - byday; |
| 777 | long hours = a->tm_hour - b->tm_hour + 24 * days; |
| 778 | long minutes = a->tm_min - b->tm_min + 60 * hours; |
| 779 | long seconds = a->tm_sec - b->tm_sec + 60 * minutes; |
| 780 | return seconds; |
| 781 | } |
| 782 | #endif |
| 783 | } |
| 784 | |
| 785 | static void |
| 786 | show(timezone_t tz, char *zone, time_t t, bool v) |
no test coverage detected