diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-09-12 13:27:51 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-09-12 13:27:51 +0000 |
commit | 24528fc273258b3e6278c9e3fdd4ce80206735ab (patch) | |
tree | 352fbc7a771d68e6e7af5f76bf5b0593e89b88ad /src/libstddjb | |
parent | 09c9957582acb207a6c1518c94df6335c3a1d5d8 (diff) | |
download | skalibs-24528fc273258b3e6278c9e3fdd4ce80206735ab.tar.xz |
New sysdeps for st.st_atim etc., timespec_cmp
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb')
-rw-r--r-- | src/libstddjb/timespec_cmp.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstddjb/timespec_cmp.c b/src/libstddjb/timespec_cmp.c new file mode 100644 index 0000000..85d23c2 --- /dev/null +++ b/src/libstddjb/timespec_cmp.c @@ -0,0 +1,13 @@ +/* ISC license. */ + +#include <time.h> + +#include <skalibs/djbtime.h> + +int timespec_cmp (struct timespec const *a, struct timespec const *b) +{ + if (a->tv_sec < b->tv_sec) return -1 ; + if (a->tv_sec > b->tv_sec) return 1 ; + if (a->tv_nsec < b->tv_nsec) return -1 ; + return a->tv_nsec > b->tv_nsec ; +} |