summaryrefslogtreecommitdiff
path: root/blame.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-03-05 22:48:01 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-03-06 00:02:44 (GMT)
commitcfea8e077b9a8956080688ab40e9efd812c2a0c5 (patch)
tree79ff446366bf1d072667313c6a8188e28a74cb57 /blame.c
parenta0fb95e3199810268cfe88c7c4ff0d9958e07062 (diff)
downloadgit-cfea8e077b9a8956080688ab40e9efd812c2a0c5.zip
git-cfea8e077b9a8956080688ab40e9efd812c2a0c5.tar.gz
git-cfea8e077b9a8956080688ab40e9efd812c2a0c5.tar.bz2
blame and annotate: show localtime with timezone.
Earlier they showed gmtime and timezone, which was inconsistent with the way our commits and tags are pretty-printed. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'blame.c')
-rw-r--r--blame.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/blame.c b/blame.c
index b551dd5..ffc1f52 100644
--- a/blame.c
+++ b/blame.c
@@ -550,13 +550,22 @@ static void get_commit_info(struct commit* commit, struct commit_info* ret)
*tmp = 0;
}
-char* format_time(unsigned long time, const char* tz)
+static const char* format_time(unsigned long time, const char* tz_str)
{
static char time_buf[128];
time_t t = time;
-
- strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S ", gmtime(&t));
- strcat(time_buf, tz);
+ int minutes, tz;
+ struct tm *tm;
+
+ tz = atoi(tz_str);
+ minutes = tz < 0 ? -tz : tz;
+ minutes = (minutes / 100)*60 + (minutes % 100);
+ minutes = tz < 0 ? -minutes : minutes;
+ t = time + minutes * 60;
+ tm = gmtime(&t);
+
+ strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S ", tm);
+ strcat(time_buf, tz_str);
return time_buf;
}