summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-04-25 17:51:02 +0200
committerAleksander Morgado <aleksander@lanedo.com>2013-04-25 17:51:02 +0200
commit06fa016582ef04df698618e88f8e70fd7cfa1de0 (patch)
treeb837868fa51299b58aecc0a7d70d7c8cc5935578
parenta3eccfc4add7ee45226184cfb786b07cb624a406 (diff)
downloadModemManager-dcbw/localtime.tar.gz
modem-helpers: fix ISO8601 string when offset is negativedcbw/localtime
So now we get this: 2013-04-25T17:44:36-02:00 Instead of this: 2013-04-25T17:44:36--2:00
-rw-r--r--src/mm-modem-helpers.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 98fb39e2a..44a00a53f 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -232,10 +232,16 @@ mm_new_iso8601_time (guint year,
g_string_append_printf (str, "%04d-%02d-%02dT%02d:%02d:%02d",
year, month, day, hour, minute, second);
if (have_offset) {
- g_string_append_printf (str, "%c%02d:%02d",
- offset_minutes >= 0 ? '+' : '-',
- offset_minutes / 60,
- offset_minutes % 60);
+ if (offset_minutes >=0 ) {
+ g_string_append_printf (str, "+%02d:%02d",
+ offset_minutes / 60,
+ offset_minutes % 60);
+ } else {
+ offset_minutes *= -1;
+ g_string_append_printf (str, "-%02d:%02d",
+ offset_minutes / 60,
+ offset_minutes % 60);
+ }
}
return g_string_free (str, FALSE);
}