From c64d82d433bd5077d75832600a6ff00ca5e9e2a5 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 19 Apr 2023 11:20:27 +0100 Subject: [PATCH] Fix broken Windows build --- examples/C/large_grib1.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/C/large_grib1.c b/examples/C/large_grib1.c index 90dcb2a89..e351f1b80 100644 --- a/examples/C/large_grib1.c +++ b/examples/C/large_grib1.c @@ -22,7 +22,10 @@ int main() int i = 0; codes_handle* h = NULL; const char* filename = "bigfile.grib"; + +#ifndef ECCODES_ON_WINDOWS unsigned int seed = time(NULL); +#endif numbytes = ni * nj * sizeof(double); values = (double*)malloc(numbytes); @@ -32,7 +35,11 @@ int main() } for (i = 0; i < ni * nj; i++) { - double r = rand_r(&seed) * 1.0 / RAND_MAX; + #ifndef ECCODES_ON_WINDOWS + double r = rand_r(&seed) * 1.0 / RAND_MAX; + #else + double r = rand() * 1.0 / RAND_MAX; + #endif values[i] = r; }