mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
guard rtc syscall
This commit is contained in:
parent
05acbe0419
commit
d46a03f030
@ -24,6 +24,7 @@
|
||||
#include "debug.h"
|
||||
|
||||
#include "rtc.h"
|
||||
#include "cpu.h"
|
||||
|
||||
static int native_rtc_enabled;
|
||||
|
||||
@ -58,10 +59,12 @@ void rtc_get_localtime(struct tm *localt)
|
||||
time_t t;
|
||||
|
||||
if (native_rtc_enabled == 1) {
|
||||
_native_in_syscall++;
|
||||
t = time(NULL);
|
||||
|
||||
if (localtime_r(&t, localt) == NULL) {
|
||||
err(1, "rtc_get_localtime: localtime_r");
|
||||
}
|
||||
_native_in_syscall--;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user