1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/shell: port random shell command to ztimer

This fixed compilation, as the use of the interal `_xtimer_now()`
function is not compatible with `ztimer_xtimer_compat`. However, this
bug never triggered due to a bug in the build system preventing the
compilation of the shell command. We are about to fix this, so let's
fix the source first.
This commit is contained in:
Marian Buschsieweke 2022-09-16 12:38:19 +02:00
parent ef80d1502a
commit 6e68744d76
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94

View File

@ -27,24 +27,22 @@
#include "random.h" #include "random.h"
#include "shell.h" #include "shell.h"
#ifdef MODULE_XTIMER #include "ztimer.h"
#include "xtimer.h"
#endif
static int _random_init(int argc, char **argv) static int _random_init(int argc, char **argv)
{ {
int initval; int initval;
if (argc == 1) { if (argc == 1) {
#ifdef MODULE_XTIMER if (IS_USED(MODULE_ZTIMER_USEC)) {
initval = _xtimer_now(); initval = ztimer_now(ZTIMER_USEC);
printf("PRNG initialized to current time: %d\n", initval); printf("PRNG initialized to current time: %d\n", initval);
#else }
(void)initval; else {
puts("xtimer module not compiled in, can't initialize by time.\n" puts("xtimer module not compiled in, can't initialize by time.\n"
"Please provide a seed.\n"); "Please provide a seed.\n");
return 1; return 1;
#endif }
} }
else { else {
initval = atoi(argv[1]); initval = atoi(argv[1]);