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