diff --git a/src/logger.c b/src/logger.c index 6fc2910..28068a8 100644 --- a/src/logger.c +++ b/src/logger.c @@ -48,8 +48,8 @@ void log_write(int level, const char *source_filename, const int line, const FIL va_end(ap); int count = snprintf(buffer, log_buffer_size, - "%s [%s] [%s:%d]%s\n", - LOG_LEVEL_NOTE[level], datetime, source_filename, line, log_buffer); + "%s [%s] [%s:%s]%s\n", + LOG_LEVEL_NOTE[level], datetime, source_filename, line_str, log_buffer); fprintf(stdout, "%s", buffer); int log_fd = fileno((FILE *) log_fp); if (flock(log_fd, LOCK_EX) == 0) { diff --git a/src/runner.c b/src/runner.c index 35c3735..04c3cc0 100644 --- a/src/runner.c +++ b/src/runner.c @@ -86,6 +86,9 @@ void run(struct config *_config, struct result *_result) { kill_pid(child_pid); ERROR_EXIT(WAIT_FAILED); } + // get end time + gettimeofday(&end, NULL); + _result->real_time = (int) (end.tv_sec * 1000 + end.tv_usec / 1000 - start.tv_sec * 1000 - start.tv_usec / 1000); // process exited, we may need to cancel timeout killer thread if (_config->max_real_time != UNLIMITED) { @@ -99,10 +102,6 @@ void run(struct config *_config, struct result *_result) { resource_usage.ru_utime.tv_usec / 1000); _result->memory = resource_usage.ru_maxrss * 1024; - // get end time - gettimeofday(&end, NULL); - _result->real_time = (int) (end.tv_sec * 1000 + end.tv_usec / 1000 - start.tv_sec * 1000 - start.tv_usec / 1000); - if (_result->exit_code != 0) { _result->result = RUNTIME_ERROR; } diff --git a/tests/test_src/integration/math.c b/tests/test_src/integration/math.c index 5a25f89..a7e918e 100644 --- a/tests/test_src/integration/math.c +++ b/tests/test_src/integration/math.c @@ -1,5 +1,5 @@ -#include #include +#include int main() { diff --git a/tests/test_src/integration/sleep.c b/tests/test_src/integration/sleep.c index abf9516..8815352 100644 --- a/tests/test_src/integration/sleep.c +++ b/tests/test_src/integration/sleep.c @@ -1,6 +1,4 @@ -#include -#include - +#include int main(int argc, char *argv[]) { sleep(4000);