Skip to content

Commit

Permalink
added -D HL_DEBUG_REPRO for some more reproducible output (when track…
Browse files Browse the repository at this point in the history
…ing gc bugs for instance)
  • Loading branch information
ncannasse committed Apr 29, 2020
1 parent d5fb717 commit a30209e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/std/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ HL_PRIM rnd *hl_rnd_init_system() {
struct timeval t;
gettimeofday(&t,NULL);
time = t.tv_sec * 1000000 + t.tv_usec;
#endif
#ifdef HL_DEBUG_REPRO
// fixed random seed
time = 4644546;
pid = 0;
#endif
hl_rnd_set_seed(r,time ^ (pid | (pid << 16)));
return r;
Expand Down
8 changes: 8 additions & 0 deletions src/std/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,15 @@ HL_PRIM void hl_sys_exit( int code ) {
exit(code);
}

#ifdef HL_DEBUG_REPRO
static double CURT = 0;
#endif

HL_PRIM double hl_sys_time() {
#ifdef HL_DEBUG_REPRO
CURT += 0.001;
return CURT;
#endif
#ifdef HL_WIN
#define EPOCH_DIFF (134774*24*60*60.0)
static double time_diff = 0.;
Expand Down

0 comments on commit a30209e

Please sign in to comment.