diff --git a/repos/libports/run/system_rtc.run b/repos/libports/run/system_rtc.run
index fb18a8433..0d872a7b1 100644
--- a/repos/libports/run/system_rtc.run
+++ b/repos/libports/run/system_rtc.run
@@ -9,7 +9,7 @@ if {[expr ![have_include power_on/qemu]]} {
set build_components {
core init timer drivers/rtc server/system_rtc test/system_rtc
- server/report_rom
+ server/report_rom test/libc_rtc
}
build $build_components
@@ -83,6 +83,20 @@ set config {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
}
install_config $config
@@ -90,6 +104,7 @@ install_config $config
set boot_components {
core ld.lib.so init timer rtc_drv test-system_rtc system_rtc
report_rom
+ test-libc_rtc libc.lib.so libm.lib.so posix.lib.so vfs.lib.so
}
build_boot_image $boot_components
diff --git a/repos/libports/src/test/libc_rtc/main.cc b/repos/libports/src/test/libc_rtc/main.cc
new file mode 100644
index 000000000..3b88a9987
--- /dev/null
+++ b/repos/libports/src/test/libc_rtc/main.cc
@@ -0,0 +1,46 @@
+/*
+ * \brief Simple libc-based RTC test using clock_gettime()
+ * \author Martin Stein
+ * \date 2019-08-13
+ */
+
+/*
+ * Copyright (C) 2019 Genode Labs GmbH
+ *
+ * This file is part of the Genode OS framework, which is distributed
+ * under the terms of the GNU Affero General Public License version 3.
+ */
+
+#include
+
+#include
+#include
+
+int main()
+{
+ unsigned idx = 1;
+ while (1) {
+ struct timespec ts;
+ if (clock_gettime(0, &ts)) {
+ return -1;
+ }
+
+ struct tm *tm = localtime((time_t*)&ts.tv_sec);
+ if (!tm) {
+ return -1;
+ }
+
+ printf("Timestamp #%d: %d-%d-%d %d:%d %ds\n",
+ idx++,
+ 1900 + tm->tm_year,
+ 1 + tm->tm_mon,
+ tm->tm_mday,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec);
+
+ sleep(1);
+ }
+
+ return 0;
+}
diff --git a/repos/libports/src/test/libc_rtc/target.mk b/repos/libports/src/test/libc_rtc/target.mk
new file mode 100644
index 000000000..94b881181
--- /dev/null
+++ b/repos/libports/src/test/libc_rtc/target.mk
@@ -0,0 +1,7 @@
+TARGET = test-libc_rtc
+LIBS = posix
+SRC_CC = main.cc
+
+vpath main.cc $(PRG_DIR)
+
+CC_CXX_WARN_STRICT =