* Fill in the localtime 'struct tm' for the supplied time, * and return the local tz. */
| 87 | * and return the local tz. |
| 88 | */ |
| 89 | static int local_time_tzoffset(time_t t, struct tm *tm) |
| 90 | { |
| 91 | time_t t_local; |
| 92 | int offset, eastwest; |
| 93 | |
| 94 | localtime_r(&t, tm); |
| 95 | t_local = tm_to_time_t(tm); |
| 96 | if (t_local == -1) |
| 97 | return 0; /* error; just use +0000 */ |
| 98 | if (t_local < t) { |
| 99 | eastwest = -1; |
| 100 | offset = t - t_local; |
| 101 | } else { |
| 102 | eastwest = 1; |
| 103 | offset = t_local - t; |
| 104 | } |
| 105 | offset /= 60; /* in minutes */ |
| 106 | offset = (offset % 60) + ((offset / 60) * 100); |
| 107 | return offset * eastwest; |
| 108 | } |
| 109 | |
| 110 | /* |
| 111 | * What value of "tz" was in effect back then at "time" in the |
no test coverage detected