aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-05-17 18:01:46 +0200
committerHarald Welte <laforge@gnumonks.org>2019-05-17 19:18:44 +0200
commit2dc67e93b23275225d75b530bf51e0c6a409beab (patch)
treed4772f9f2629ed0374e19ae00d1f12218f4fc8cc
parentbd5d3e44f6ec88a21cd64859ea615581b8fad3d8 (diff)
Command to obtain RTC date/time
This will display the time; However, as the host is not telling us anything about the current date/time [yet], we will always be in "N seconds since 1970". Change-Id: Ic23152db65a01eefd28d67e0132a82352875e467
-rw-r--r--sysmoOCTSIM/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 091cd0b..f11fe58 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -946,6 +946,15 @@ DEFUN(sim_iccid, cmd_sim_iccid, "sim-iccid", "Read ICCID from SIM card")
ncn8025_set(slotnr, &settings);
}
+DEFUN(get_time, cmd_get_time, "get-time", "Read Time from RTC")
+{
+ struct calendar_date_time dt;
+ calendar_get_date_time(&CALENDAR_0, &dt);
+ printf("%04u-%02u-%02u %02u:%02u:%02u\r\n", dt.date.year, dt.date.month, dt.date.day,
+ dt.time.hour, dt.time.min, dt.time.sec);
+}
+
+
extern void testmode_init(void);
extern void libosmo_emb_init(void);
@@ -1034,6 +1043,7 @@ int main(void)
command_register(&cmd_talloc_test);
command_register(&cmd_talloc_report);
command_register(&cmd_talloc_free);
+ command_register(&cmd_get_time);
printf("\r\n\r\n"
"=============================================================================\n\r"