X-Git-Url: https://git.ucc.asn.au/?p=matches%2Fhonours.git;a=blobdiff_plain;f=course%2Fsemester2%2Fpprog%2Fassignment1%2Fsingle-thread%2Fnbody.c;h=e4b4bc701f1f1485231ee33c1b11867ae3d17431;hp=67afd0fd1e69b266600bc4df4f7ceb07f7058929;hb=df06a43b2727b939ee572a1ddaa39e707aff030a;hpb=6529f76db3022ec72ca7718d5e2bc3f176b474e9 diff --git a/course/semester2/pprog/assignment1/single-thread/nbody.c b/course/semester2/pprog/assignment1/single-thread/nbody.c index 67afd0fd..e4b4bc70 100644 --- a/course/semester2/pprog/assignment1/single-thread/nbody.c +++ b/course/semester2/pprog/assignment1/single-thread/nbody.c @@ -235,6 +235,8 @@ void DisplayStatistics() */ bool ExitCondition(void) { - return (runstate != RUN || (options.timeout > 0.00 && ((unsigned)(time(NULL) - options.start_time.tv_sec) >= options.timeout)) + bool result = (runstate != RUN || (options.timeout > 0.00 && ((unsigned)(time(NULL) - options.start_time.tv_sec) >= options.timeout)) || (options.num_steps > 0 && universe.steps > options.num_steps)); + //printf("runstate %d\n timeout %d\n steps %d\n", (int)(runstate != RUN), (int)(options.timeout > 0.00 && ((unsigned)(time(NULL) - options.start_time.tv_sec) >= options.timeout)), (int)(options.num_steps > 0 && universe.steps > options.num_steps)); + return result; }