gnucash maint: [date-utilities.scm] typo fix and deprecate unused functions

Christopher Lam clam at code.gnucash.org
Sun Mar 7 00:36:23 EST 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/3739d912 (commit)
	from  https://github.com/Gnucash/gnucash/commit/7bacd82c (commit)



commit 3739d9121c475582475e4a151c412c712fcab5ac
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Mar 7 10:24:05 2021 +0800

    [date-utilities.scm] typo fix and deprecate unused functions

diff --git a/libgnucash/app-utils/date-utilities.scm b/libgnucash/app-utils/date-utilities.scm
index 77b84afad..6579b0a70 100644
--- a/libgnucash/app-utils/date-utilities.scm
+++ b/libgnucash/app-utils/date-utilities.scm
@@ -790,12 +790,13 @@ Defaulting to today."))
       (gnc-mktime now))))
 
 (define (gnc:get-three-months-ago)
+  (issue-deprecation-warning "gnc:get-three-months-ago is unused.")
   (let ((now (gnc-localtime (current-time))))
     (if (< (tm:mon now) 3)
 	(begin
-	  (set:tm-mon now (+ (tm:mon now) 12))
-	  (set:tm-year now  (- (tm:year now) 1))))
-    (set:tm-mon now (- (tm:mon now) 3))
+	  (set-tm:mon now (+ (tm:mon now) 12))
+	  (set-tm:year now  (- (tm:year now) 1))))
+    (set-tm:mon now (- (tm:mon now) 3))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
                                          (+ (tm:year now) 1900))))
       (if (< month-days (tm:mday now))
@@ -804,12 +805,13 @@ Defaulting to today."))
       (gnc-mktime now))))
 
 (define (gnc:get-six-months-ago)
+  (issue-deprecation-warning "gnc:get-six-months-ago is unused.")
   (let ((now (gnc-localtime (current-time))))
     (if (< (tm:mon now) 6)
 	(begin
-	  (set:tm-mon now (+ (tm:mon now) 12))
-	  (set:tm-year now  (- (tm:year now) 1))))
-    (set:tm-mon now (- (tm:mon now) 6))
+	  (set-tm:mon now (+ (tm:mon now) 12))
+	  (set-tm:year now  (- (tm:year now) 1))))
+    (set-tm:mon now (- (tm:mon now) 6))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
                                          (+ (tm:year now) 1900))))
       (if (< month-days (tm:mday now))
@@ -818,8 +820,9 @@ Defaulting to today."))
       (gnc-mktime now))))
 
 (define (gnc:get-one-year-ago)
+  (issue-deprecation-warning "gnc:get-one-year-ago is unused.")
   (let ((now (gnc-localtime (current-time))))
-    (set:tm-year now (- (tm:year now) 1))
+    (set-tm:year now (- (tm:year now) 1))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
                                          (+ (tm:year now) 1900))))
       (if (< month-days (tm:mday now))
@@ -842,12 +845,13 @@ Defaulting to today."))
       (gnc-mktime now))))
 
 (define (gnc:get-three-months-ahead)
+  (issue-deprecation-warning "gnc:get-three-months-ahead is unused.")
   (let ((now (gnc-localtime (current-time))))
     (if (> (tm:mon now) 8)
 	(begin
-	  (set:tm-mon now (- (tm:mon now) 9))
-	  (set:tm-year now  (+ (tm:year now) 1))
-          (set:tm-mon now (+ (tm:mon now) 3))))
+	  (set-tm:mon now (- (tm:mon now) 9))
+	  (set-tm:year now  (+ (tm:year now) 1))
+          (set-tm:mon now (+ (tm:mon now) 3))))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
                                          (+ (tm:year now) 1900))))
       (if (< month-days (tm:mday now))
@@ -856,12 +860,13 @@ Defaulting to today."))
       (gnc-mktime now))))
 
 (define (gnc:get-six-months-ahead)
+  (issue-deprecation-warning "gnc:get-six-months-ahead is unused.")
   (let ((now (gnc-localtime (current-time))))
     (if (> (tm:mon now) 5)
 	(begin
-	  (set:tm-mon now (- (tm:mon now) 6))
-	  (set:tm-year now  (+ (tm:year now) 1))
-          (set:tm-mon now (+ (tm:mon now) 6))))
+	  (set-tm:mon now (- (tm:mon now) 6))
+	  (set-tm:year now  (+ (tm:year now) 1))
+          (set-tm:mon now (+ (tm:mon now) 6))))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
                                          (+ (tm:year now) 1900))))
       (if (< month-days (tm:mday now))
@@ -870,8 +875,9 @@ Defaulting to today."))
       (gnc-mktime now))))
 
 (define (gnc:get-one-year-ahead)
+  (issue-deprecation-warning "gnc:get-one-year-ahead is unused.")
   (let ((now (gnc-localtime (current-time))))
-    (set:tm-year now (+ (tm:year now) 1))
+    (set-tm:year now (+ (tm:year now) 1))
     (let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
                                          (+ (tm:year now) 1900))))
       (if (< month-days (tm:mday now))



Summary of changes:
 libgnucash/app-utils/date-utilities.scm | 34 +++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)



More information about the gnucash-changes mailing list