]> git.ipfire.org Git - pakfire.git/commitdiff
util: Drop any custom timespec functions
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 19 Jul 2022 16:23:13 +0000 (16:23 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 19 Jul 2022 16:23:13 +0000 (16:23 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/util.h
src/libpakfire/util.c

index 46929bc6eb8559bcdbaf3326d9219baf1f85924a..fc99f820028ebca079b49e6bc9d2cf076437a8f0 100644 (file)
 
 #include <pwd.h>
 #include <stdio.h>
-#include <time.h>
 
 #include <archive.h>
 
-
 #include <pakfire/package.h>
 
 const char* pakfire_dep2str(struct pakfire* pakfire, Id id);
@@ -116,14 +114,6 @@ int pakfire_json_add_integer(struct pakfire* pakfire,
 int pakfire_json_add_string_array(struct pakfire* pakfire,
        struct json_object* json, const char* name, char** array);
 
-// Time Stuff
-
-struct timespec timespec_add(const struct timespec* t1, const struct timespec* t2);
-
-struct timespec timespec_from_ms(int milliseconds);
-
-int timespec_lt(struct timespec* t1, struct timespec* t2);
-
 // Resource Limits
 
 #define PAKFIRE_RLIMIT_NOFILE_MAX (512 * 1024)
index fd3a014d8afdace7345e9a66ae1c7ca075c3533c..83f0b8608887e0bdf4ef8109689c2ae011b4a8d2 100644 (file)
@@ -32,7 +32,6 @@
 #include <sys/resource.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <time.h>
 #include <unistd.h>
 
 #include <archive.h>
@@ -1193,48 +1192,6 @@ int pakfire_json_add_integer(struct pakfire* pakfire, struct json_object* json,
        return json_object_object_add(json, name, object);
 }
 
-// Time Stuff
-
-static void timespec_normalize(struct timespec* t) {
-       while (t->tv_nsec >= NSEC_PER_SEC) {
-               t->tv_sec++;
-               t->tv_nsec -= NSEC_PER_SEC;
-       }
-
-       while (t->tv_nsec <= -NSEC_PER_SEC) {
-               t->tv_sec--;
-               t->tv_nsec += NSEC_PER_SEC;
-       }
-}
-
-struct timespec timespec_add(const struct timespec* t1, const struct timespec* t2) {
-       struct timespec r = {
-               .tv_sec  = t1->tv_sec  + t2->tv_sec,
-               .tv_nsec = t2->tv_nsec + t2->tv_nsec,
-       };
-
-       // Correct any negative values
-       timespec_normalize(&r);
-
-       return r;
-}
-
-struct timespec timespec_from_ms(int milliseconds) {
-       struct timespec t = {
-               .tv_sec  = (milliseconds / 1000),
-               .tv_nsec = (milliseconds % 1000) * 1000000,
-       };
-       
-       return t;
-}
-
-int timespec_lt(struct timespec* t1, struct timespec* t2) {    
-       return (
-               t1->tv_sec < t2->tv_sec ||
-               (t1->tv_sec == t2->tv_sec && t1->tv_nsec < t2->tv_nsec)
-       );
-}
-
 // Resource Limits
 
 int pakfire_rlimit_set(struct pakfire* pakfire, int limit) {