projects
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
92e2311
)
date.c: fix printout of timezone offsets that aren't exact hours
author
Linus Torvalds
<torvalds@ppc970.osdl.org>
Sat, 30 Apr 2005 23:18:41 +0000
(16:18 -0700)
committer
Linus Torvalds
<torvalds@ppc970.osdl.org>
Sat, 30 Apr 2005 23:18:41 +0000
(16:18 -0700)
We'd get the sign wrong for the minutes part of a negative offset.
date.c
patch
|
blob
|
history
diff --git
a/date.c
b/date.c
index
d3bae90
..
77a7958
100644
(file)
--- a/
date.c
+++ b/
date.c
@@
-250,7
+250,7
@@
static int match_tz(char *date, int *offp)
void parse_date(char *date, char *result, int maxlen)
{
struct tm tm;
- int offset;
+ int offset
, sign
;
time_t then;
memset(&tm, 0, sizeof(tm));
@@
-293,7
+293,13
@@
void parse_date(char *date, char *result, int maxlen)
then -= offset * 60;
- snprintf(result, maxlen, "%lu %+03d%02d", then, offset/60, offset % 60);
+ sign = '+';
+ if (offset < 0) {
+ offset = -offset;
+ sign = '-';
+ }
+
+ snprintf(result, maxlen, "%lu %c%02d%02d", then, sign, offset/60, offset % 60);
}
void datestamp(char *buf, int bufsize)