MISC: Timezone can be negative: handle that case as well
authorPaul Kocialkowski <contact@paulk.fr>
Fri, 8 Feb 2013 21:35:03 +0000 (22:35 +0100)
committerPaul Kocialkowski <contact@paulk.fr>
Fri, 8 Feb 2013 21:35:03 +0000 (22:35 +0100)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
misc.c

diff --git a/misc.c b/misc.c
index 035a061..6c06e54 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -236,9 +236,10 @@ void ipc_misc_time_info(struct ipc_message_info *info)
        struct ipc_misc_time_info *nitz = (struct ipc_misc_time_info*) info->data;
        char str[128];
 
-       sprintf(str, "%02u/%02u/%02u,%02u:%02u:%02u+%02d,%02d",
+       sprintf(str, "%02u/%02u/%02u,%02u:%02u:%02u%c%02d,%02d",
                nitz->year, nitz->mon, nitz->day, nitz->hour,
-               nitz->min, nitz->sec, nitz->tz, 0);
+               nitz->min, nitz->sec, nitz->tz < 0 ? '-' : '+',
+               nitz->tz < 0 ? -nitz->tz : nitz->tz, 0);
 
        ril_request_unsolicited(RIL_UNSOL_NITZ_TIME_RECEIVED,
                str, strlen(str) + 1);