summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 92e2311)
raw | patch | inline | side by side (parent: 92e2311)
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 |
index d3bae90677ca89f366439cf26596831c3fb847c5..77a7958d49e7ed59107c5fb4dde7c51e08fea11f 100644 (file)
--- a/date.c
+++ b/date.c
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));
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)