diff --git a/repos/libports/lib/mk/libc.mk b/repos/libports/lib/mk/libc.mk
index a4f13993ec..515caaf29a 100644
--- a/repos/libports/lib/mk/libc.mk
+++ b/repos/libports/lib/mk/libc.mk
@@ -16,7 +16,7 @@ SRC_CC = atexit.cc dummies.cc rlimit.cc sysctl.cc \
malloc.cc progname.cc fd_alloc.cc file_operations.cc \
plugin.cc plugin_registry.cc select.cc exit.cc environ.cc sleep.cc \
pread_pwrite.cc readv_writev.cc poll.cc \
- vfs_plugin.cc rtc.cc dynamic_linker.cc signal.cc \
+ vfs_plugin.cc dynamic_linker.cc signal.cc \
socket_operations.cc task.cc socket_fs_plugin.cc syscall.cc \
getpwent.cc getrandom.cc
diff --git a/repos/libports/src/lib/libc/rtc.cc b/repos/libports/src/lib/libc/rtc.cc
deleted file mode 100644
index a45d6d80f2..0000000000
--- a/repos/libports/src/lib/libc/rtc.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * \brief C-library back end
- * \author Josef Soentgen
- * \date 2014-08-20
- */
-
-/*
- * Copyright (C) 2014-2017 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
-#include
-#include
-#include
-#include
-#include
-
-
-namespace Libc {
- extern char const *config_rtc();
- time_t read_rtc();
-}
-
-time_t Libc::read_rtc()
-{
- time_t rtc = 0;
-
- if (!Genode::strcmp(Libc::config_rtc(), "")) {
- Genode::warning("rtc not configured, returning ", rtc);
- return rtc;
- }
-
- int fd = open(Libc::config_rtc(), O_RDONLY);
- if (fd == -1) {
- Genode::warning(Genode::Cstring(Libc::config_rtc()), " not readable, returning ", rtc);
- return rtc;
- }
-
- char buf[32];
- ssize_t n = read(fd, buf, sizeof(buf));
- if (n > 0) {
- buf[n - 1] = '\0';
- struct tm tm;
- Genode::memset(&tm, 0, sizeof(tm));
-
- if (strptime(buf, "%Y-%m-%d %R", &tm)) {
- rtc = mktime(&tm);
- if (rtc == (time_t)-1)
- rtc = 0;
- }
- }
-
- close(fd);
-
- return rtc;
-}
diff --git a/repos/libports/src/lib/libc/time.cc b/repos/libports/src/lib/libc/time.cc
index eed2458e2f..6df80b385b 100644
--- a/repos/libports/src/lib/libc/time.cc
+++ b/repos/libports/src/lib/libc/time.cc
@@ -14,6 +14,12 @@
/* Libc includes */
#include
+#include
+#include
+#include
+#include
+
+
#include "task.h"
#include "libc_errno.h"
@@ -21,7 +27,46 @@
/* Genode includes */
#include
-namespace Libc { time_t read_rtc(); }
+
+namespace Libc {
+ extern char const *config_rtc();
+ time_t read_rtc();
+}
+
+
+time_t Libc::read_rtc()
+{
+ time_t rtc = 0;
+
+ if (!Genode::strcmp(Libc::config_rtc(), "")) {
+ Genode::warning("rtc not configured, returning ", rtc);
+ return rtc;
+ }
+
+ int fd = open(Libc::config_rtc(), O_RDONLY);
+ if (fd == -1) {
+ Genode::warning(Genode::Cstring(Libc::config_rtc()), " not readable, returning ", rtc);
+ return rtc;
+ }
+
+ char buf[32];
+ ssize_t n = read(fd, buf, sizeof(buf));
+ if (n > 0) {
+ buf[n - 1] = '\0';
+ struct tm tm;
+ Genode::memset(&tm, 0, sizeof(tm));
+
+ if (strptime(buf, "%Y-%m-%d %R", &tm)) {
+ rtc = mktime(&tm);
+ if (rtc == (time_t)-1)
+ rtc = 0;
+ }
+ }
+
+ close(fd);
+
+ return rtc;
+}
extern "C" __attribute__((weak))