mirror of
https://github.com/json-c/json-c.git
synced 2026-03-30 10:29:06 +08:00
Issue #594 - provide an OVERRIDE_GET_RANDOM_SEED cmake variable to override json_c_get_random_seed() for embedded platforms where time(NULL) doesn't work.
Example:
mkdir build && cd build
cmake -DOVERRIDE_GET_RANDOM_SEED='do { extern uint32_t getMsTicks(void); int ms = getMsTicks() * 433494437; return ms; } while(0)' ..
This commit is contained in:
@@ -276,6 +276,9 @@ static int get_time_seed(void)
|
||||
|
||||
int json_c_get_random_seed(void)
|
||||
{
|
||||
#ifdef OVERRIDE_GET_RANDOM_SEED
|
||||
OVERRIDE_GET_RANDOM_SEED;
|
||||
#endif
|
||||
#if defined HAVE_RDRAND && HAVE_RDRAND
|
||||
if (has_rdrand())
|
||||
return get_rdrand_seed();
|
||||
|
||||
Reference in New Issue
Block a user