Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
blame and annotate: show localtime with timezone.
author
Junio C Hamano
<junkio@cox.net>
Sun, 5 Mar 2006 22:48:01 +0000
(14:48 -0800)
committer
Junio C Hamano
<junkio@cox.net>
Mon, 6 Mar 2006 00:02:44 +0000
(16:02 -0800)
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>
blame.c
patch
|
blob
|
history
git-annotate.perl
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
a0fb95e
)
diff --git
a/blame.c
b/blame.c
index b551dd5aa3b2af1ef4d5c2870f18ba4900d50d22..ffc1f52add2a29afbaae6b67bf43616caa1b0710 100644
(file)
--- a/
blame.c
+++ b/
blame.c
@@
-550,13
+550,22
@@
static void get_commit_info(struct commit* commit, struct commit_info* ret)
*tmp = 0;
}
*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;
{
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;
}
return time_buf;
}
diff --git
a/git-annotate.perl
b/git-annotate.perl
index d93ee19c7e7ff42762071c9df6f31da5dfa0fe80..b113def97bd41c18f3d6e24c9952c50dbb8e2ad8 100755
(executable)
--- a/
git-annotate.perl
+++ b/
git-annotate.perl
@@
-418,7
+418,13
@@
sub format_date {
return $_[0];
}
my ($timestamp, $timezone) = split(' ', $_[0]);
return $_[0];
}
my ($timestamp, $timezone) = split(' ', $_[0]);
- return strftime("%Y-%m-%d %H:%M:%S " . $timezone, gmtime($timestamp));
+ my $minutes = abs($timezone);
+ $minutes = int($minutes / 100) * 60 + ($minutes % 100);
+ if ($timezone < 0) {
+ $minutes = -$minutes;
+ }
+ my $t = $timestamp + $minutes * 60;
+ return strftime("%Y-%m-%d %H:%M:%S " . $timezone, gmtime($t));
}
# Copied from git-send-email.perl - We need a Git.pm module..
}
# Copied from git-send-email.perl - We need a Git.pm module..