]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
ProgressCounter::find_accounting(state=0) return start_t & end_t
authorAlain Spineux <alain@baculasystems.com>
Fri, 27 Aug 2021 13:42:29 +0000 (15:42 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:03 +0000 (09:03 +0100)
- this allow to use find_accounting() method instead of accessing
  directly the fields start_t & end_t

bacula/src/lib/progress.h

index 9fc36b87d0a31267cc4e8a5638bc9b531b5b2b7b..592d5f1bfa29b70b34f27e0f47e5042bdc4017d5 100644 (file)
@@ -98,13 +98,18 @@ Tmsg3(0, "ASX change_state %c acc_n=%d acc_capacity=%d\n", new_state, acc_n, acc
    bool is_canceled() { return cancel; };
    void set_cancel(bool new_cancel = true) { cancel = new_cancel; }
    void done(int new_state = 0) { state = new_state; end_t = time(NULL); if (acc_n>0) {accountings[acc_n-1].end_t = end_t; } };
-   bool find_accounting(int state, int64_t *start_t, int64_t *end_t) {
+   bool find_accounting(int state, int64_t *start, int64_t *end) {
+      if (state == 0) {
+         *start = start_t;
+         *end = end_t;
+         return true;
+      }
       int i = find_accounting(state);
       if (i == -1) {
          return false; // not found
       }
-      *start_t = accountings[i].start_t;
-      *end_t = accountings[i].end_t;
+      *start = accountings[i].start_t;
+      *end = accountings[i].end_t;
       return true;
    }