Skip to content

Commit

Permalink
Use macro to define earlier_than
Browse files Browse the repository at this point in the history
  • Loading branch information
HiGarfield committed Jan 23, 2025
1 parent 2c0ed08 commit 20eca73
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/process_iterator_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,10 @@ static int get_start_time(pid_t pid, struct timespec *start_time)
return ret;
}

static int earlier_than(const struct timespec *t1, const struct timespec *t2)
{
return t1->tv_sec < t2->tv_sec ||
(t1->tv_sec == t2->tv_sec && t1->tv_nsec < t2->tv_nsec);
}
/* int earlier_than(const struct timespec *t1, const struct timespec *t2) */
#define earlier_than(t1, t2) \
((t1)->tv_sec < (t2)->tv_sec || \
((t1)->tv_sec == (t2)->tv_sec && (t1)->tv_nsec < (t2)->tv_nsec))

int is_child_of(pid_t child_pid, pid_t parent_pid)
{
Expand Down

0 comments on commit 20eca73

Please sign in to comment.