summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--date.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/date.c b/date.c
index d3bae90677..77a7958d49 100644
--- 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)