From 14cf8d7ba8a917c9872d9952178d7c93f2e7b3c6 Mon Sep 17 00:00:00 2001 From: a1346054 <36859588+a1346054@users.noreply.github.com> Date: Tue, 21 Sep 2021 20:43:41 +0000 Subject: [PATCH 1/3] Fix spelling --- src/faketime_common.h | 2 +- src/libfaketime.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/faketime_common.h b/src/faketime_common.h index 0ae5fd4..ab47d89 100644 --- a/src/faketime_common.h +++ b/src/faketime_common.h @@ -45,7 +45,7 @@ struct ft_shared_s * When advancing time linearly with each time(), etc. call, the calls are * counted here */ uint64_t ticks; - /* Index of timstamp to be loaded from file */ + /* Index of timestamp to be loaded from file */ uint64_t file_idx; /* System time Faketime started at */ struct system_time_s start_time; diff --git a/src/libfaketime.c b/src/libfaketime.c index 0dd037b..6fc2dfd 100644 --- a/src/libfaketime.c +++ b/src/libfaketime.c @@ -750,7 +750,7 @@ static bool load_time(struct timespec *tp) if ((sizeof(stss[0]) * (ft_shared->file_idx + 1)) > infile_size) { - /* we are out of timstamps to replay, return to faking time by rules + /* we are out of timestamps to replay, return to faking time by rules * using last timestamp from file as the user provided timestamp */ timespec_from_saved(&user_faked_time_timespec, &stss[(infile_size / sizeof(stss[0])) - 1 ]); @@ -2811,7 +2811,7 @@ static void ftpl_init(void) } } - /* load file only if reading timstamps from it is not finished yet */ + /* load file only if reading timestamps from it is not finished yet */ if ((tmp_env = getenv("FAKETIME_LOAD_FILE")) != NULL) { int infile = -1; From aa9eb1006dbf3d02c51614f795f1b85aca5aa8e4 Mon Sep 17 00:00:00 2001 From: a1346054 <36859588+a1346054@users.noreply.github.com> Date: Tue, 21 Sep 2021 20:52:08 +0000 Subject: [PATCH 2/3] Fix codestyle deviations --- src/faketime.c | 2 +- src/libfaketime.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/faketime.c b/src/faketime.c index 17356d5..a2faa66 100644 --- a/src/faketime.c +++ b/src/faketime.c @@ -114,7 +114,7 @@ int main (int argc, char **argv) bool fake_pid = false; const char *pid_val; - while(curr_opt < argc) + while (curr_opt < argc) { if (0 == strcmp(argv[curr_opt], "-m")) { diff --git a/src/libfaketime.c b/src/libfaketime.c index 6fc2dfd..4ce88ca 100644 --- a/src/libfaketime.c +++ b/src/libfaketime.c @@ -268,7 +268,7 @@ static sem_t *shared_sem = NULL; /** Data shared among faketime-spawned processes */ static struct ft_shared_s *ft_shared = NULL; -/** Storage format for timestamps written to file. Big endian.*/ +/** Storage format for timestamps written to file. Big endian. */ struct saved_timestamp { int64_t sec; @@ -335,7 +335,7 @@ static struct timespec user_faked_time_timespec = {0, -1}; static bool user_faked_time_set = false; static char user_faked_time_saved[BUFFERLEN] = {0}; -/* Fractional user offset provided through FAKETIME env. var.*/ +/* Fractional user offset provided through FAKETIME env. var. */ static struct timespec user_offset = {0, -1}; /* Speed up or slow down clock */ static double user_rate = 1.0; @@ -1842,7 +1842,7 @@ timer_settime_common(timer_t_or_int timerid, int flags, } else if (dont_fake) { - /* cast away constness*/ + /* cast away constness */ new_real_pt = (struct itimerspec *)new_value; } else @@ -2484,7 +2484,7 @@ parse_modifiers: else if (NULL != (tmp_time_fmt = strchr(user_faked_time, 'i'))) { double tick_inc = atof(tmp_time_fmt + 1); - /* increment time with every time() call*/ + /* increment time with every time() call */ user_per_tick_inc.tv_sec = floor(tick_inc); user_per_tick_inc.tv_nsec = (tick_inc - user_per_tick_inc.tv_sec) * SEC_TO_nSEC ; user_per_tick_inc_set = true; @@ -2966,7 +2966,7 @@ int read_config_file() (faketimerc = fopen("/etc/faketimerc", "rt")) != NULL) { static char line[BUFFERLEN]; - while(fgets(line, BUFFERLEN, faketimerc) != NULL) + while (fgets(line, BUFFERLEN, faketimerc) != NULL) { if ((strlen(line) > 1) && (line[0] != ' ') && (line[0] != '#') && (line[0] != ';')) @@ -3174,7 +3174,7 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp) case FT_START_AT: /* User-specified offset */ if (user_per_tick_inc_set) { - /* increment time with every time() call*/ + /* increment time with every time() call */ next_time(tp, &user_per_tick_inc); } else @@ -3631,7 +3631,7 @@ int pthread_cond_timedwait_common(pthread_cond_t *cond, pthread_mutex_t *mutex, CLOCK_MONOTONIC. */ #ifndef __ARM_ARCH #ifndef FORCE_MONOTONIC_FIX - if(clk_id == CLOCK_MONOTONIC) + if (clk_id == CLOCK_MONOTONIC) timespecadd(&faketime, &tdiff_actual, &tp); else #endif From 543f6b5040a74078230cf42a0ff751d7c21cd29a Mon Sep 17 00:00:00 2001 From: a1346054 <36859588+a1346054@users.noreply.github.com> Date: Tue, 21 Sep 2021 20:33:52 +0000 Subject: [PATCH 3/3] Trim excess whitespace --- .github/workflows/make-test.yml | 2 +- .gitignore | 1 - .travis.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/make-test.yml b/.github/workflows/make-test.yml index 751e58e..ce13dea 100644 --- a/.github/workflows/make-test.yml +++ b/.github/workflows/make-test.yml @@ -6,7 +6,7 @@ on: - master - develop schedule: - - cron: '30 9 * * *' + - cron: '30 9 * * *' jobs: build: diff --git a/.gitignore b/.gitignore index 6dfed37..db6c4a0 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,3 @@ src/libfaketime.dylib.1 src/libfaketime.1.dylib src/core src/faketime - diff --git a/.travis.yml b/.travis.yml index d460876..eb000b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,6 @@ script: - if [ "$TRAVIS_ARCH" = ppc64le ]; then FAKETIME_COMPILE_CFLAGS="-DFORCE_MONOTONIC_FIX -DFORCE_PTHREAD_NONVER" make; else - FAKETIME_COMPILE_CFLAGS="-DFORCE_MONOTONIC_FIX" make; + FAKETIME_COMPILE_CFLAGS="-DFORCE_MONOTONIC_FIX" make; fi - make test