fix times (and timezone)

- in the index and log show the short time (GMT).
- in the Atom feed use GMT time.
- for commits show the time + offset.
This commit is contained in:
Hiltjo Posthuma
2016-05-01 16:10:17 +02:00
parent 7a1da0b985
commit 462ba66ee7
2 changed files with 30 additions and 20 deletions

View File

@@ -42,25 +42,19 @@ xmlencode(FILE *fp, const char *s, size_t len)
}
void
printtimeformat(FILE *fp, const git_time *intime, const char *fmt)
printtimeshort(FILE *fp, const git_time *intime)
{
struct tm *intm;
time_t t;
char out[32];
t = (time_t) intime->time + (intime->offset * 60);
t = (time_t)intime->time;
if (!(intm = gmtime(&t)))
return;
strftime(out, sizeof(out), fmt, intm);
strftime(out, sizeof(out), "%Y-%m-%d %H:%M", intm);
fputs(out, fp);
}
void
printtimeshort(FILE *fp, const git_time *intime)
{
printtimeformat(fp, intime, "%Y-%m-%d %H:%M");
}
int
writeheader(FILE *fp)
{