summaryrefslogtreecommitdiffstats
path: root/unit/test-sms.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-06-05 11:51:46 -0500
committerDenis Kenzior <denkenz@gmail.com>2009-06-05 19:57:40 -0500
commit41071737d02a92b64de0d83b3cd2c9d4cabecb37 (patch)
treedfea0795d9367051451b03ca270eb8b6e6879182 /unit/test-sms.c
parentb149dc166c964d4504198e8c3896c0a7f6d33c43 (diff)
downloadofono-41071737d02a92b64de0d83b3cd2c9d4cabecb37.tar.bz2
Add utility to convert SCTS to local/remote time
Diffstat (limited to 'unit/test-sms.c')
-rw-r--r--unit/test-sms.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/unit/test-sms.c b/unit/test-sms.c
index d644cda0..6057076e 100644
--- a/unit/test-sms.c
+++ b/unit/test-sms.c
@@ -38,6 +38,10 @@ static const char *simple_submit = "0011000B916407281553F80000AA"
static void print_scts(struct sms_scts *scts, const char *prefix)
{
+ time_t ts;
+ struct tm remote;
+ char buf[128];
+
g_print("%s: (YY-MM-DD) %02d-%02d-%02d\n", prefix,
(int)scts->year, (int)scts->month, (int)scts->day);
@@ -47,6 +51,18 @@ static void print_scts(struct sms_scts *scts, const char *prefix)
g_print("%s: Timezone %d hours %d minutes\n", prefix,
(int)scts->timezone / 4,
(int)((abs(scts->timezone) % 4) * 15));
+
+ ts = sms_scts_to_time(scts, &remote);
+
+ strftime(buf, 127, "%a, %d %b %Y %H:%M:%S %z", localtime(&ts));
+ buf[127] = '\0';
+
+ g_print("local time: %s\n", buf);
+
+ strftime(buf, 127, "%a, %d %b %Y %H:%M:%S %z", &remote);
+ buf[127] = '\0';
+
+ g_print("remote time: %s\n", buf);
}
static void print_vpf(enum sms_validity_period_format vpf,