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