diff --git a/Makefile.dep b/Makefile.dep
index 86dbc62bd928d7080bf69b23fcc96736820be4eb..59a25739bf1e9eb823d3eebc799971ee090f9246 100644
--- a/Makefile.dep
+++ b/Makefile.dep
@@ -8,6 +8,12 @@ OLD_USEPKG := $(sort $(USEPKG))
 # pull dependencies from drivers
 include $(RIOTBASE)/drivers/Makefile.dep
 
+ifneq (,$(filter cbor_ctime,$(USEMODULE)))
+  ifneq (,$(filter newlib,$(USEMODULE)))
+    USEMODULE += newlib_gnu_source
+  endif
+endif
+
 ifneq (,$(filter csma_sender,$(USEMODULE)))
   USEMODULE += random
   USEMODULE += xtimer
@@ -381,6 +387,10 @@ ifneq (,$(filter od,$(USEMODULE)))
   USEMODULE += fmt
 endif
 
+ifneq (,$(filter newlib_gnu_source,$(USEMODULE)))
+  USEMODULE += newlib
+endif
+
 ifneq (,$(filter newlib_nano,$(USEMODULE)))
   USEMODULE += newlib
 endif
diff --git a/makefiles/libc/newlib.mk b/makefiles/libc/newlib.mk
index c45b2a5a1393b9181eb84915ed34303d942ec9e6..3d49cc42f06b8a7e8ccf6123421223e3376b5ee9 100644
--- a/makefiles/libc/newlib.mk
+++ b/makefiles/libc/newlib.mk
@@ -9,6 +9,10 @@ ifneq (,$(filter newlib_nano,$(USEMODULE)))
   endif
 endif
 
+ifneq (,$(filter newlib_gnu_source,$(USEMODULE)))
+  CFLAGS += -D_GNU_SOURCE=1
+endif
+
 ifeq (1,$(USE_NEWLIB_NANO))
   export LINKFLAGS += -specs=nano.specs
 endif
diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk
index 458ea356e902c777b1c139b6f6c05c65edf6395e..7317231e63accdfc9379775ede521f08ee4c9445 100644
--- a/makefiles/pseudomodules.inc.mk
+++ b/makefiles/pseudomodules.inc.mk
@@ -52,6 +52,7 @@ PSEUDOMODULES += netstats_l2
 PSEUDOMODULES += netstats_ipv6
 PSEUDOMODULES += netstats_rpl
 PSEUDOMODULES += newlib
+PSEUDOMODULES += newlib_gnu_source
 PSEUDOMODULES += newlib_nano
 PSEUDOMODULES += openthread
 PSEUDOMODULES += pktqueue
diff --git a/sys/cbor/Makefile b/sys/cbor/Makefile
index 8e1c52a54e9ce9a0e30b15e6170418dec532835c..bd0de579634d1b3c57f18e5ab0f26fdc4967b2bc 100644
--- a/sys/cbor/Makefile
+++ b/sys/cbor/Makefile
@@ -1,7 +1,7 @@
 MODULE = cbor
 
 ifneq ($(shell uname -s),Darwin)
-	CFLAGS += -D_XOPEN_SOURCE=600
+  CFLAGS += -D_XOPEN_SOURCE=600
 endif
 
 include $(RIOTBASE)/Makefile.base
diff --git a/sys/cbor/cbor.c b/sys/cbor/cbor.c
index 05a918cd38b6dab04fc3fc604f0576bd133e6bc0..ebab47cbeeb937cd72748a5aa5c1f034e331c06b 100644
--- a/sys/cbor/cbor.c
+++ b/sys/cbor/cbor.c
@@ -24,6 +24,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef MODULE_CBOR_CTIME
+#include <time.h>
+#endif
 #define ENABLE_DEBUG (0)
 #include "debug.h"