Skip to content

Commit

Permalink
in_dummy: rename time interval variables.
Browse files Browse the repository at this point in the history
Signed-off-by: Francisco Valente <[email protected]>
  • Loading branch information
franciscovalentecastro committed Oct 18, 2023
1 parent f5266f2 commit 16beb5a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugins/in_dummy/in_dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ static int configure(struct flb_dummy *ctx,
struct timespec *tm)
{
const char *msg;
double tmfrac;
double tm_interval_fractional;
int tm_interval_seconds;
int root_type;
int ret = -1;

Expand All @@ -219,9 +220,10 @@ static int configure(struct flb_dummy *ctx,
tm->tv_nsec = 0;

if (ctx->rate > 1) {
tmfrac = (double) ctx->time_interval / ctx->rate;
tm->tv_sec = tmfrac;
tm->tv_nsec = (tmfrac - (int) tmfrac) * 1000000000;
tm_interval_fractional = (double) ctx->time_interval / ctx->rate;
tm_interval_seconds = (int) tm_interval_fractional;
tm->tv_sec = tm_interval_seconds;
tm->tv_nsec = (tm_interval_fractional - tm_interval_seconds) * 1000000000;
}

/* dummy timestamp */
Expand Down

0 comments on commit 16beb5a

Please sign in to comment.