MCPcopy Index your code
hub / github.com/git/git / local_time_tzoffset

Function local_time_tzoffset

date.c:89–108  ·  view source on GitHub ↗

* Fill in the localtime 'struct tm' for the supplied time, * and return the local tz. */

Source from the content-addressed store, hash-verified

87 * and return the local tz.
88 */
89static 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

Callers 2

local_tzoffsetFunction · 0.85
show_dateFunction · 0.85

Calls 2

localtime_rFunction · 0.85
tm_to_time_tFunction · 0.85

Tested by

no test coverage detected