diff options
Diffstat (limited to 'ui-stats.c')
-rw-r--r-- | ui-stats.c | 48 |
1 files changed, 24 insertions, 24 deletions
@@ -166,7 +166,7 @@ static void add_commit(struct string_list *authors, struct commit *commit, | |||
166 | struct authorstat *authorstat; | 166 | struct authorstat *authorstat; |
167 | struct string_list *items; | 167 | struct string_list *items; |
168 | char *tmp; | 168 | char *tmp; |
169 | struct tm *date; | 169 | struct tm date; |
170 | time_t t; | 170 | time_t t; |
171 | uintptr_t *counter; | 171 | uintptr_t *counter; |
172 | 172 | ||
@@ -180,9 +180,9 @@ static void add_commit(struct string_list *authors, struct commit *commit, | |||
180 | authorstat = author->util; | 180 | authorstat = author->util; |
181 | items = &authorstat->list; | 181 | items = &authorstat->list; |
182 | t = info->committer_date; | 182 | t = info->committer_date; |
183 | date = gmtime(&t); | 183 | gmtime_r(&t, &date); |
184 | period->trunc(date); | 184 | period->trunc(&date); |
185 | tmp = xstrdup(period->pretty(date)); | 185 | tmp = xstrdup(period->pretty(&date)); |
186 | item = string_list_insert(items, tmp); | 186 | item = string_list_insert(items, tmp); |
187 | counter = (uintptr_t *)&item->util; | 187 | counter = (uintptr_t *)&item->util; |
188 | if (*counter) | 188 | if (*counter) |
@@ -215,15 +215,15 @@ static struct string_list collect_stats(const struct cgit_period *period) | |||
215 | int argc = 3; | 215 | int argc = 3; |
216 | time_t now; | 216 | time_t now; |
217 | long i; | 217 | long i; |
218 | struct tm *tm; | 218 | struct tm tm; |
219 | char tmp[11]; | 219 | char tmp[11]; |
220 | 220 | ||
221 | time(&now); | 221 | time(&now); |
222 | tm = gmtime(&now); | 222 | gmtime_r(&now, &tm); |
223 | period->trunc(tm); | 223 | period->trunc(&tm); |
224 | for (i = 1; i < period->count; i++) | 224 | for (i = 1; i < period->count; i++) |
225 | period->dec(tm); | 225 | period->dec(&tm); |
226 | strftime(tmp, sizeof(tmp), "%Y-%m-%d", tm); | 226 | strftime(tmp, sizeof(tmp), "%Y-%m-%d", &tm); |
227 | argv[2] = xstrdup(fmt("--since=%s", tmp)); | 227 | argv[2] = xstrdup(fmt("--since=%s", tmp)); |
228 | if (ctx.qry.path) { | 228 | if (ctx.qry.path) { |
229 | argv[3] = "--"; | 229 | argv[3] = "--"; |
@@ -261,21 +261,21 @@ static void print_combined_authorrow(struct string_list *authors, int from, | |||
261 | struct string_list_item *date; | 261 | struct string_list_item *date; |
262 | time_t now; | 262 | time_t now; |
263 | long i, j, total, subtotal; | 263 | long i, j, total, subtotal; |
264 | struct tm *tm; | 264 | struct tm tm; |
265 | char *tmp; | 265 | char *tmp; |
266 | 266 | ||
267 | time(&now); | 267 | time(&now); |
268 | tm = gmtime(&now); | 268 | gmtime_r(&now, &tm); |
269 | period->trunc(tm); | 269 | period->trunc(&tm); |
270 | for (i = 1; i < period->count; i++) | 270 | for (i = 1; i < period->count; i++) |
271 | period->dec(tm); | 271 | period->dec(&tm); |
272 | 272 | ||
273 | total = 0; | 273 | total = 0; |
274 | htmlf("<tr><td class='%s'>%s</td>", leftclass, | 274 | htmlf("<tr><td class='%s'>%s</td>", leftclass, |
275 | fmt(name, to - from + 1)); | 275 | fmt(name, to - from + 1)); |
276 | for (j = 0; j < period->count; j++) { | 276 | for (j = 0; j < period->count; j++) { |
277 | tmp = period->pretty(tm); | 277 | tmp = period->pretty(&tm); |
278 | period->inc(tm); | 278 | period->inc(&tm); |
279 | subtotal = 0; | 279 | subtotal = 0; |
280 | for (i = from; i <= to; i++) { | 280 | for (i = from; i <= to; i++) { |
281 | author = &authors->items[i]; | 281 | author = &authors->items[i]; |
@@ -300,20 +300,20 @@ static void print_authors(struct string_list *authors, int top, | |||
300 | struct string_list_item *date; | 300 | struct string_list_item *date; |
301 | time_t now; | 301 | time_t now; |
302 | long i, j, total; | 302 | long i, j, total; |
303 | struct tm *tm; | 303 | struct tm tm; |
304 | char *tmp; | 304 | char *tmp; |
305 | 305 | ||
306 | time(&now); | 306 | time(&now); |
307 | tm = gmtime(&now); | 307 | gmtime_r(&now, &tm); |
308 | period->trunc(tm); | 308 | period->trunc(&tm); |
309 | for (i = 1; i < period->count; i++) | 309 | for (i = 1; i < period->count; i++) |
310 | period->dec(tm); | 310 | period->dec(&tm); |
311 | 311 | ||
312 | html("<table class='stats'><tr><th>Author</th>"); | 312 | html("<table class='stats'><tr><th>Author</th>"); |
313 | for (j = 0; j < period->count; j++) { | 313 | for (j = 0; j < period->count; j++) { |
314 | tmp = period->pretty(tm); | 314 | tmp = period->pretty(&tm); |
315 | htmlf("<th>%s</th>", tmp); | 315 | htmlf("<th>%s</th>", tmp); |
316 | period->inc(tm); | 316 | period->inc(&tm); |
317 | } | 317 | } |
318 | html("<th>Total</th></tr>\n"); | 318 | html("<th>Total</th></tr>\n"); |
319 | 319 | ||
@@ -329,10 +329,10 @@ static void print_authors(struct string_list *authors, int top, | |||
329 | items = &authorstat->list; | 329 | items = &authorstat->list; |
330 | total = 0; | 330 | total = 0; |
331 | for (j = 0; j < period->count; j++) | 331 | for (j = 0; j < period->count; j++) |
332 | period->dec(tm); | 332 | period->dec(&tm); |
333 | for (j = 0; j < period->count; j++) { | 333 | for (j = 0; j < period->count; j++) { |
334 | tmp = period->pretty(tm); | 334 | tmp = period->pretty(&tm); |
335 | period->inc(tm); | 335 | period->inc(&tm); |
336 | date = string_list_lookup(items, tmp); | 336 | date = string_list_lookup(items, tmp); |
337 | if (!date) | 337 | if (!date) |
338 | html("<td>0</td>"); | 338 | html("<td>0</td>"); |