cli, plugins: factorize usage of iso8601 datetime format

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>

Includes updates by Aleksander Morgado to fix coding style issues.
This commit is contained in:
Frederic Martinsons
2021-10-22 13:48:20 +02:00
committed by Aleksander Morgado
parent 0510e9aef8
commit 9d82d30978
16 changed files with 131 additions and 112 deletions
@@ -29,6 +29,7 @@
#include "mm-errors-types.h"
#include "mm-modem-helpers-cinterion.h"
#include "mm-modem-helpers.h"
#include "mm-common-helpers.h"
#include "mm-port-serial-at.h"
/* Setup relationship between the 3G band bitmask in the modem and the bitmask
@@ -1359,7 +1359,7 @@ static void
test_ctzu_urc_simple (void)
{
const gchar *urc = "\r\n+CTZU: \"19/07/09,11:15:40\",+08\r\n";
const gchar *expected_iso8601 = "2019-07-09T11:15:40+02:00";
const gchar *expected_iso8601 = "2019-07-09T11:15:40+02";
gint expected_offset = 120;
gint expected_dst_offset = -1; /* not given */
@@ -1370,7 +1370,7 @@ static void
test_ctzu_urc_full (void)
{
const gchar *urc = "\r\n+CTZU: \"19/07/09,11:15:40\",+08,1\r\n";
const gchar *expected_iso8601 = "2019-07-09T11:15:40+02:00";
const gchar *expected_iso8601 = "2019-07-09T11:15:40+02";
gint expected_offset = 120;
gint expected_dst_offset = 60;
+1
View File
@@ -23,6 +23,7 @@
#include <libmm-glib.h>
#include "mm-log-object.h"
#include "mm-common-helpers.h"
#include "mm-modem-helpers.h"
#include "mm-modem-helpers-huawei.h"
#include "mm-huawei-enums-types.h"
@@ -1072,32 +1072,32 @@ typedef struct {
static const NwtimeTest nwtime_tests[] = {
{ "^NWTIME: 14/08/05,04:00:21+40,00", TRUE, TRUE, FALSE,
"2014-08-05T04:00:21+10:00", 600, 0, NWT_UNKNOWN },
"2014-08-05T04:00:21+10", 600, 0, NWT_UNKNOWN },
{ "^NWTIME: 14/08/05,04:00:21+40,00", TRUE, FALSE, TRUE,
"2014-08-05T04:00:21+10:00", 600, 0, NWT_UNKNOWN },
"2014-08-05T04:00:21+10", 600, 0, NWT_UNKNOWN },
{ "^NWTIME: 14/08/05,04:00:21+40,00", TRUE, TRUE, TRUE,
"2014-08-05T04:00:21+10:00", 600, 0, NWT_UNKNOWN },
"2014-08-05T04:00:21+10", 600, 0, NWT_UNKNOWN },
{ "^NWTIME: 14/08/05,04:00:21+20,00", TRUE, TRUE, FALSE,
"2014-08-05T04:00:21+05:00", 300, 0, NWT_UNKNOWN },
"2014-08-05T04:00:21+05", 300, 0, NWT_UNKNOWN },
{ "^NWTIME: 14/08/05,04:00:21+20,00", TRUE, FALSE, TRUE,
"2014-08-05T04:00:21+05:00", 300, 0, NWT_UNKNOWN },
"2014-08-05T04:00:21+05", 300, 0, NWT_UNKNOWN },
{ "^NWTIME: 14/08/05,04:00:21+20,00", TRUE, TRUE, TRUE,
"2014-08-05T04:00:21+05:00", 300, 0, NWT_UNKNOWN },
"2014-08-05T04:00:21+05", 300, 0, NWT_UNKNOWN },
{ "^NWTIME: 14/08/05,04:00:21+40,01", TRUE, TRUE, FALSE,
"2014-08-05T04:00:21+11:00", 600, 60, NWT_UNKNOWN },
"2014-08-05T04:00:21+11", 600, 60, NWT_UNKNOWN },
{ "^NWTIME: 14/08/05,04:00:21+40,01", TRUE, FALSE, TRUE,
"2014-08-05T04:00:21+11:00", 600, 60, NWT_UNKNOWN },
"2014-08-05T04:00:21+11", 600, 60, NWT_UNKNOWN },
{ "^NWTIME: 14/08/05,04:00:21+40,01", TRUE, TRUE, TRUE,
"2014-08-05T04:00:21+11:00", 600, 60, NWT_UNKNOWN },
"2014-08-05T04:00:21+11", 600, 60, NWT_UNKNOWN },
{ "^NWTIME: 14/08/05,04:00:21+40,02", TRUE, TRUE, FALSE,
"2014-08-05T04:00:21+12:00", 600, 120, NWT_UNKNOWN },
"2014-08-05T04:00:21+12", 600, 120, NWT_UNKNOWN },
{ "^NWTIME: 14/08/05,04:00:21+40,02", TRUE, FALSE, TRUE,
"2014-08-05T04:00:21+12:00", 600, 120, NWT_UNKNOWN },
"2014-08-05T04:00:21+12", 600, 120, NWT_UNKNOWN },
{ "^NWTIME: 14/08/05,04:00:21+40,02", TRUE, TRUE, TRUE,
"2014-08-05T04:00:21+12:00", 600, 120, NWT_UNKNOWN },
"2014-08-05T04:00:21+12", 600, 120, NWT_UNKNOWN },
{ "^TIME: XX/XX/XX,XX:XX:XX+XX,XX", FALSE, TRUE, FALSE,
NULL, NWT_UNKNOWN, NWT_UNKNOWN, NWT_UNKNOWN },
@@ -1155,8 +1155,8 @@ typedef struct {
} TimeTest;
static const TimeTest time_tests[] = {
{ "^TIME: 14/08/05 04:00:21", TRUE, "2014-08-05T04:00:21" },
{ "^TIME: 2014/08/05 04:00:21", TRUE, "2014-08-05T04:00:21" },
{ "^TIME: 14/08/05 04:00:21", TRUE, "2014-08-05T04:00:21Z" },
{ "^TIME: 2014/08/05 04:00:21", TRUE, "2014-08-05T04:00:21Z" },
{ "^TIME: 14-08-05 04:00:21", FALSE, NULL },
{ "^TIME: 14-08-05,04:00:21", FALSE, NULL },
{ "^TIME: 14/08/05 04:00:21 AEST", FALSE, NULL },
+1
View File
@@ -32,6 +32,7 @@
#include "mm-iface-modem-3gpp.h"
#include "mm-iface-modem-3gpp-profile-manager.h"
#include "mm-iface-modem-time.h"
#include "mm-common-helpers.h"
#include "mm-base-modem-at.h"
#include "mm-bearer-list.h"
#include "mm-broadband-bearer-icera.h"
@@ -33,6 +33,7 @@
#include "mm-broadband-modem-novatel.h"
#include "mm-errors-types.h"
#include "mm-modem-helpers.h"
#include "mm-common-helpers.h"
#include "libqcdm/src/commands.h"
#include "libqcdm/src/result.h"
#include "mm-log-object.h"
@@ -28,6 +28,7 @@
#include "mm-base-modem-at.h"
#include "mm-log-object.h"
#include "mm-modem-helpers.h"
#include "mm-common-helpers.h"
#include "mm-errors-types.h"
#include "mm-iface-modem.h"
#include "mm-iface-modem-3gpp.h"