tools: Move definition of timeval_delta() to tools/ctdb.c
authorMartin Schwenke <martin@meltin.net>
Fri, 15 Aug 2014 05:53:03 +0000 (15:53 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Fri, 27 Mar 2015 02:56:20 +0000 (13:56 +1100)
This function is only used in this file.  Samba's lib/util doesn't
have timeval_delta(), so staging a clean transition.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(Imported from commit 6e1568149ede06d48b91bbc7ecd8c55da3b41a41)

include/internal/includes.h
lib/util/util_time.c
tools/ctdb.c

index db87d66ddc6b84e4e5c61c374463068fdac906c1..36fb946d8757891e3185a698c0da696cae5f2319 100644 (file)
@@ -55,7 +55,6 @@ struct timeval timeval_until(const struct timeval *tv1,
                             const struct timeval *tv2);
 _PUBLIC_ struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs);
 double timeval_elapsed(struct timeval *tv);
-double timeval_delta(struct timeval *tv2, struct timeval *tv);
 char **file_lines_load(const char *fname, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx);
 char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len);
 _PUBLIC_ int set_blocking(int fd, bool set);
index be14f26458abe7c19561063ba90280561de79a46..13ddfdb2b6e5b0094bf5bc93c725f81299d48339 100644 (file)
@@ -44,12 +44,6 @@ double timeval_elapsed(struct timeval *tv)
               (tv2.tv_usec - tv->tv_usec)*1.0e-6;
 }
 
-double timeval_delta(struct timeval *tv2, struct timeval *tv)
-{
-       return (tv2->tv_sec - tv->tv_sec) + 
-              (tv2->tv_usec - tv->tv_usec)*1.0e-6;
-}
-
 /**
   return a timeval struct with the given elements
 */
index 608d50a3000953be14f0846441aa605d224d9a9f..82f095d8c0d2ba4df8c571e1895e5e6aefdc30cd 100644 (file)
@@ -58,6 +58,12 @@ static struct {
 #define TIMELIMIT() timeval_current_ofs(options.timelimit, 0)
 #define LONGTIMELIMIT() timeval_current_ofs(LONGTIMEOUT, 0)
 
+static double timeval_delta(struct timeval *tv2, struct timeval *tv)
+{
+       return (tv2->tv_sec - tv->tv_sec) +
+               (tv2->tv_usec - tv->tv_usec)*1.0e-6;
+}
+
 static int control_version(struct ctdb_context *ctdb, int argc, const char **argv)
 {
        printf("CTDB version: %s\n", CTDB_VERSION_STRING);