sys: shell: mersenne: adapt to xtimer

dev/timer
Kaspar Schleiser 8 years ago
parent 940db9dad5
commit fcb666dff9

@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 Freie Universität Berlin
* 2015 Kaspar Schleiser <kaspar@schleiser.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -14,7 +15,7 @@
* @brief Shell commands for mersenne twister
*
* @author Christian Mehlis <mehlis@inf.fu-berlin.de>
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
* @}
*/
@ -23,7 +24,10 @@
#include <string.h>
#include <inttypes.h>
#include "hwtimer.h"
#ifdef MODULE_XTIMER
#include "xtimer.h"
#endif
#include "random.h"
int _mersenne_init(int argc, char **argv)
@ -31,8 +35,13 @@ int _mersenne_init(int argc, char **argv)
int initval;
if (argc == 1) {
initval = hwtimer_now();
#ifdef MODULE_XTIMER
initval = xtimer_now();
printf("PRNG initialized to current time: %d\n", initval);
#else
(void)initval;
printf("xtimer module not compiled in, can't initialize by time.\n");
#endif
}
else {
initval = atoi(argv[1]);

Loading…
Cancel
Save