gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Sun Dec 11 20:42:44 EST 2016
Updated via https://github.com/Gnucash/gnucash/commit/3ed1c761 (commit)
via https://github.com/Gnucash/gnucash/commit/54beffd9 (commit)
via https://github.com/Gnucash/gnucash/commit/78b41f7a (commit)
from https://github.com/Gnucash/gnucash/commit/ad208810 (commit)
commit 3ed1c7616df3b828f50165a0b68b5c16a4d17480
Author: John Ralls <jralls at ceridwen.us>
Date: Sun Dec 11 17:21:28 2016 -0800
Remove QIF importer error âDates earlier than 1970 are not supportedâ.
Because they are. The parser canât figure out years earlier than 1930,
but thatâs not really a major concern.
diff --git a/src/import-export/qif-imp/qif-to-gnc.scm b/src/import-export/qif-imp/qif-to-gnc.scm
index 48bed59..519d6e9 100644
--- a/src/import-export/qif-imp/qif-to-gnc.scm
+++ b/src/import-export/qif-imp/qif-to-gnc.scm
@@ -481,15 +481,7 @@
"Missing transaction date."
#f
#f))
- ((< (list-ref qif-date 2) 1970)
- (qif-import:log progress-dialog
- "qif-import:qif-xtn-to-gnc-xtn"
- (_ "Dates earlier than 1970 are not supported."))
- (throw 'bad-date
- "qif-import:qif-xtn-to-gnc-xtn"
- "Invalid transaction year (~A)."
- (list (list-ref qif-date 2))
- #f))
+
(else
(apply xaccTransSetDate gnc-xtn (qif-xtn:date qif-xtn))))
commit 54beffd9367221402ff09fb8493e8112fe637732
Author: John Ralls <jralls at ceridwen.us>
Date: Sun Dec 11 16:32:15 2016 -0800
Bug 685329 - Crashes on non-existent date
Log an error instead of crashing. The transaction will be imported with
todayâs date.
diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c
index 9547eb3..c43812f 100644
--- a/src/engine/Transaction.c
+++ b/src/engine/Transaction.c
@@ -1973,9 +1973,15 @@ xaccTransSetDate (Transaction *trans, int day, int mon, int year)
GDate *date;
if (!trans) return;
date = g_date_new_dmy(day, mon, year);
- g_assert(g_date_valid(date));
+ if (!g_date_valid(date))
+ {
+ PWARN("Attempted to set invalid date %d-%d-%d; set today's date instead.",
+ year, mon, day);
+ g_free(date);
+ date = gnc_g_date_new_today();
+ }
xaccTransSetDatePostedGDate(trans, *date);
- g_date_free(date);
+ g_free(date);
}
void
commit 78b41f7ac14d1a19f588e1d9ef6cb4a10bb276b7
Author: John Ralls <jralls at ceridwen.us>
Date: Sun Dec 11 15:23:55 2016 -0800
Bug 772369 - Replace use of guile's internal date/time functions
with our own implementation of gnc-date.
diff --git a/src/app-utils/date-utilities.scm b/src/app-utils/date-utilities.scm
index 940a651..03faa8f 100644
--- a/src/app-utils/date-utilities.scm
+++ b/src/app-utils/date-utilities.scm
@@ -35,10 +35,10 @@
(cons secs 0))
(define (gnc:timepair->date tp)
- (localtime (gnc:timepair->secs tp)))
+ (gnc-localtime (gnc:timepair->secs tp)))
(define (gnc:date->timepair date)
- (gnc:secs->timepair (car (mktime date))))
+ (gnc:secs->timepair (gnc-mktime date)))
(define (gnc:timepair? date)
(and (number? (car date))
@@ -143,15 +143,15 @@
;; convert a date in seconds since 1970 into # of years since 1970 as
;; a fraction.
(define (gnc:date-to-year-fraction caltime)
- (let ((lt (localtime caltime)))
+ (let ((lt (gnc-localtime caltime)))
(+ (- (gnc:date-get-year lt) 1970)
(/ (- (gnc:date-get-year-day lt) 1.0)
(* 1.0 (gnc:days-in-year (gnc:date-get-year lt)))))))
;; return the number of years (in floating point format) between two dates.
(define (gnc:date-year-delta caltime1 caltime2)
- (let* ((lt1 (localtime caltime1))
- (lt2 (localtime caltime2))
+ (let* ((lt1 (gnc-localtime caltime1))
+ (lt2 (gnc-localtime caltime2))
(day1 (gnc:date-get-year-day lt1))
(day2 (gnc:date-get-year-day lt2))
(year1 (gnc:date-get-year lt1))
@@ -180,7 +180,7 @@
;; convert a date in seconds since 1970 into # of months since 1970
(define (gnc:date-to-month-fraction caltime)
- (let ((lt (localtime caltime)))
+ (let ((lt (gnc-localtime caltime)))
(+ (* 12 (- (gnc:date-get-year lt) 1970.0))
(gnc:date-get-month lt) -1
(/ (- (gnc:date-get-month-day lt) 1.0) (gnc:days-in-month
@@ -315,7 +315,7 @@
; Note: use of eval is evil... by making this a generator function,
; each delta function gets its own instance of Zero Date
(define (make-zdate)
- (let ((zd (localtime 0)))
+ (let ((zd (gnc-localtime (current-time))))
(set-tm:hour zd 0)
(set-tm:min zd 0)
(set-tm:sec zd 0)
@@ -479,7 +479,7 @@
(gnc:reldate-get-desc rel-date-info)))
(define (gnc:get-start-cal-year)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 0)
(set-tm:min now 0)
(set-tm:hour now 0)
@@ -489,7 +489,7 @@
(gnc:date->timepair now)))
(define (gnc:get-end-cal-year)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 59)
(set-tm:min now 59)
(set-tm:hour now 23)
@@ -499,7 +499,7 @@
(gnc:date->timepair now)))
(define (gnc:get-start-prev-year)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 0)
(set-tm:min now 0)
(set-tm:hour now 0)
@@ -510,7 +510,7 @@
(gnc:date->timepair now)))
(define (gnc:get-end-prev-year)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 59)
(set-tm:min now 59)
(set-tm:hour now 23)
@@ -521,7 +521,7 @@
(gnc:date->timepair now)))
(define (gnc:get-start-next-year)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 0)
(set-tm:min now 0)
(set-tm:hour now 0)
@@ -532,7 +532,7 @@
(gnc:date->timepair now)))
(define (gnc:get-end-next-year)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 59)
(set-tm:min now 59)
(set-tm:hour now 23)
@@ -549,7 +549,7 @@
(gnc:secs->timepair (gnc-accounting-period-fiscal-end)))
(define (gnc:get-start-this-month)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 0)
(set-tm:min now 0)
(set-tm:hour now 0)
@@ -558,7 +558,7 @@
(gnc:date->timepair now)))
(define (gnc:get-end-this-month)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 59)
(set-tm:min now 59)
(set-tm:hour now 23)
@@ -568,7 +568,7 @@
(gnc:date->timepair now)))
(define (gnc:get-start-prev-month)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 0)
(set-tm:min now 0)
(set-tm:hour now 0)
@@ -582,7 +582,7 @@
(gnc:date->timepair now)))
(define (gnc:get-end-prev-month)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 59)
(set-tm:min now 59)
(set-tm:hour now 23)
@@ -597,7 +597,7 @@
(gnc:date->timepair now)))
(define (gnc:get-start-next-month)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 0)
(set-tm:min now 0)
(set-tm:hour now 0)
@@ -611,7 +611,7 @@
(gnc:date->timepair now)))
(define (gnc:get-end-next-month)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 59)
(set-tm:min now 59)
(set-tm:hour now 23)
@@ -626,7 +626,7 @@
(gnc:date->timepair now)))
(define (gnc:get-start-current-quarter)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 0)
(set-tm:min now 0)
(set-tm:hour now 0)
@@ -636,7 +636,7 @@
(gnc:date->timepair now)))
(define (gnc:get-end-current-quarter)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 59)
(set-tm:min now 59)
(set-tm:hour now 23)
@@ -648,7 +648,7 @@
(gnc:date->timepair now)))
(define (gnc:get-start-prev-quarter)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 0)
(set-tm:min now 0)
(set-tm:hour now 0)
@@ -663,7 +663,7 @@
(gnc:date->timepair now)))
(define (gnc:get-end-prev-quarter)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 59)
(set-tm:min now 59)
(set-tm:hour now 23)
@@ -679,7 +679,7 @@
(gnc:date->timepair now)))
(define (gnc:get-start-next-quarter)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 0)
(set-tm:min now 0)
(set-tm:hour now 0)
@@ -693,7 +693,7 @@
(gnc:date->timepair now)))
(define (gnc:get-end-next-quarter)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set-tm:sec now 59)
(set-tm:min now 59)
(set-tm:hour now 23)
@@ -712,7 +712,7 @@
(cons (current-time) 0))
(define (gnc:get-one-month-ago)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(if (= (tm:mon now) 0)
(begin
(set-tm:mon now 11)
@@ -726,7 +726,7 @@
(gnc:date->timepair now))))
(define (gnc:get-three-months-ago)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(if (< (tm:mon now) 3)
(begin
(set:tm-mon now (+ (tm:mon now) 12))
@@ -740,7 +740,7 @@
(gnc:date->timepair now))))
(define (gnc:get-six-months-ago)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(if (< (tm:mon now) 6)
(begin
(set:tm-mon now (+ (tm:mon now) 12))
@@ -754,7 +754,7 @@
(gnc:date->timepair now))))
(define (gnc:get-one-year-ago)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set:tm-year now (- (tm:year now) 1))
(let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
(+ (tm:year now) 1900))))
@@ -764,7 +764,7 @@
(gnc:date->timepair now))))
(define (gnc:get-one-month-ahead)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(if (= (tm:mon now) 11)
(begin
(set-tm:mon now 0)
@@ -778,7 +778,7 @@
(gnc:date->timepair now))))
(define (gnc:get-three-months-ahead)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(if (> (tm:mon now) 8)
(begin
(set:tm-mon now (- (tm:mon now) 9))
@@ -792,7 +792,7 @@
(gnc:date->timepair now))))
(define (gnc:get-six-months-ahead)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(if (> (tm:mon now) 5)
(begin
(set:tm-mon now (- (tm:mon now) 6))
@@ -806,7 +806,7 @@
(gnc:date->timepair now))))
(define (gnc:get-one-year-ahead)
- (let ((now (localtime (current-time))))
+ (let ((now (gnc-localtime (current-time))))
(set:tm-year now (+ (tm:year now) 1))
(let ((month-days (gnc:days-in-month (+ (tm:mon now) 1)
(+ (tm:year now) 1900))))
diff --git a/src/base-typemaps.i b/src/base-typemaps.i
index 1072fe6..727949f 100644
--- a/src/base-typemaps.i
+++ b/src/base-typemaps.i
@@ -67,6 +67,53 @@ typedef char gchar;
%typemap(in) gint64 " $1 = scm_to_int64($input); "
%typemap(out) gint64 " $result = scm_from_int64($1); "
+%typemap(in) time64 " $1 = scm_to_int64($input); "
+%typemap(out) time64 " $result = scm_from_int64($1); "
+%typemap(in) time64 * (time64 t) "t = scm_to_int64($input); $1 = &t;"
+%typemap(out) time64 * " $result = ($1) ? scm_from_int64(*($1)) : SCM_BOOL_F; "
+
+%typemap(in) struct tm * {
+ SCM tm = $input;
+ struct tm t = {
+ scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 0)),
+ scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 1)),
+ scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 2)),
+ scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 3)),
+ scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 4)),
+ scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 5)),
+ scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 6)),
+ scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 7)),
+ scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 8)),
+#ifdef HAVE_STRUCT_TM_GMTOFF
+ scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 9)),
+ scm_to_locale_string(SCM_SIMPLE_VECTOR_REF(tm, 10)),
+#endif
+ };
+ $1 = &t;
+ }
+
+%typemap(out) struct tm * {
+ SCM tm = scm_c_make_vector(11, SCM_UNDEFINED);
+ struct tm* t = $1;
+ SCM_SIMPLE_VECTOR_SET(tm, 0, scm_from_int(t->tm_sec));
+ SCM_SIMPLE_VECTOR_SET(tm, 1, scm_from_int(t->tm_min));
+ SCM_SIMPLE_VECTOR_SET(tm, 2, scm_from_int(t->tm_hour));
+ SCM_SIMPLE_VECTOR_SET(tm, 3, scm_from_int(t->tm_mday));
+ SCM_SIMPLE_VECTOR_SET(tm, 4, scm_from_int(t->tm_mon));
+ SCM_SIMPLE_VECTOR_SET(tm, 5, scm_from_int(t->tm_year));
+ SCM_SIMPLE_VECTOR_SET(tm, 6, scm_from_int(t->tm_wday));
+ SCM_SIMPLE_VECTOR_SET(tm, 7, scm_from_int(t->tm_yday));
+ SCM_SIMPLE_VECTOR_SET(tm, 8, scm_from_int(t->tm_isdst));
+#ifdef HAVE_STRUCT_TM_GMTOFF
+ SCM_SIMPLE_VECTOR_SET(tm, 9, scm_from_long(t->tm_gmtoff));
+ SCM_SIMPLE_VECTOR_SET(tm, 10, scm_from_locale_string(t->tm_zone));
+#else
+ SCM_SIMPLE_VECTOR_SET(tm, 9, scm_from_long(0));
+ SCM_SIMPLE_VECTOR_SET(tm, 10, scm_from_locale_string("GMT"));
+#endif
+ $result = tm;
+ }
+
%define GLIST_HELPER_INOUT(ListType, ElemSwigType)
%typemap(in) ListType * {
SCM list = $input;
diff --git a/src/engine/test/test-extras.scm b/src/engine/test/test-extras.scm
index 0541ce5..06e0ebd 100644
--- a/src/engine/test/test-extras.scm
+++ b/src/engine/test/test-extras.scm
@@ -138,15 +138,15 @@
(let ((txn (xaccMallocTransaction (gnc-get-current-book)))
(split-1 (xaccMallocSplit (gnc-get-current-book)))
(split-2 (xaccMallocSplit (gnc-get-current-book)))
- (localtime (gnc:timepair->date date)))
+ (gnc-localtime (gnc:timepair->date date)))
(with-transaction txn
(lambda ()
(xaccTransSetDescription txn (env-string env "ponies"))
(xaccTransSetCurrency txn (gnc-default-report-currency))
(xaccTransSetDate txn
- (gnc:date-get-month-day localtime)
- (gnc:date-get-month localtime)
- (gnc:date-get-year localtime))
+ (gnc:date-get-month-day gnc-localtime)
+ (gnc:date-get-month gnc-localtime)
+ (gnc:date-get-year gnc-localtime))
(xaccSplitSetParent split-1 txn)
(xaccSplitSetParent split-2 txn)
(xaccSplitSetAccount split-1 credit)
diff --git a/src/engine/test/test-split.scm b/src/engine/test/test-split.scm
index 96dab5e..7c14389 100644
--- a/src/engine/test/test-split.scm
+++ b/src/engine/test/test-split.scm
@@ -12,7 +12,7 @@
(define (test-split-in-list?)
(let* ((env (create-test-env))
- (today (gnc:date->timepair (localtime (current-time))))
+ (today (gnc:date->timepair (gnc-localtime (current-time))))
(account-alist (env-create-test-accounts env))
(bank-account (cdr (assoc "Bank" account-alist)))
(expense-account (cdr (assoc "Expenses" account-alist)))
diff --git a/src/import-export/qif-imp/qif-parse.scm b/src/import-export/qif-imp/qif-parse.scm
index ca6bf9f..dab31f6 100644
--- a/src/import-export/qif-imp/qif-parse.scm
+++ b/src/import-export/qif-imp/qif-parse.scm
@@ -139,11 +139,8 @@
;; 2000 => 100.) We also want to allow full year specifications,
;; (i.e. 1999, 2001, etc) and there's a point at which you can't
;; determine which is which. this should eventually be another
- ;; field in the qif-file struct but not yet. mktime in scheme
- ;; doesn't deal with dates before December 14, 1901, at least for
- ;; now, so let's give ourselves until at least 3802 before this
- ;; does the wrong thing.
- ((and (integer? post-read-value)
+ ;; field in the qif-file struct but not yet.
+ ((and (integer? post-read-value)
(< post-read-value 1902))
(set! y2k-fixed-value (+ 1900 post-read-value)))
@@ -643,7 +640,7 @@
(if all-ok parsed #f)))
(define (qif-parse:print-date date-list)
- (let ((tm (localtime (current-time))))
+ (let ((tm (gnc-localtime (current-time))))
(set-tm:mday tm (car date-list))
(set-tm:mon tm (- (cadr date-list) 1))
(set-tm:year tm (- (caddr date-list) 1900))
diff --git a/src/report/business-reports/easy-invoice.scm b/src/report/business-reports/easy-invoice.scm
index 709f863..fd07ce9 100644
--- a/src/report/business-reports/easy-invoice.scm
+++ b/src/report/business-reports/easy-invoice.scm
@@ -813,7 +813,7 @@
(_ "INVOICE NOT POSTED")
"</font>"))))
;(add-html! document (strftime (opt-val "Text" "Today Date Format")
- ; (localtime (car (gnc:get-today))))))
+ ; (gnc-localtime (car (gnc:get-today))))))
(make-break! document)
diff --git a/src/report/business-reports/fancy-invoice.scm b/src/report/business-reports/fancy-invoice.scm
index b7c1af0..0721c1d 100644
--- a/src/report/business-reports/fancy-invoice.scm
+++ b/src/report/business-reports/fancy-invoice.scm
@@ -670,7 +670,7 @@
;; for the invoice date/due date fields
;; I could have taken the format from the report options, but... ;)
(string-expand (strftime (gnc-default-strftime-date-format)
- (localtime (car date)))
+ (gnc-localtime (car date)))
#\space " ")
;;(string-expand (gnc-print-date date) #\space " ")
)))
@@ -762,7 +762,7 @@
;; (gnc:html-table-append-row! table (list
;; (strftime
;; date-format
-;; (localtime (car (gnc:get-today))))))
+;; (gnc-localtime (car (gnc:get-today))))))
table))
(define (make-break! document)
diff --git a/src/report/business-reports/invoice.scm b/src/report/business-reports/invoice.scm
index 2baf6bb..7bcbee6 100644
--- a/src/report/business-reports/invoice.scm
+++ b/src/report/business-reports/invoice.scm
@@ -629,7 +629,7 @@
(gnc:html-table-append-row! table (list
(strftime
date-format
- (localtime (car (gnc:get-today))))))
+ (gnc-localtime (car (gnc:get-today))))))
table))
(define (make-break! document)
diff --git a/src/report/business-reports/job-report.scm b/src/report/business-reports/job-report.scm
index eb5f158..1356240 100644
--- a/src/report/business-reports/job-report.scm
+++ b/src/report/business-reports/job-report.scm
@@ -537,7 +537,7 @@
(gnc:html-table-append-row! table (list
(strftime
date-format
- (localtime (car (gnc:get-today))))))
+ (gnc-localtime (car (gnc:get-today))))))
table))
(define (make-break! document)
diff --git a/src/report/business-reports/owner-report.scm b/src/report/business-reports/owner-report.scm
index 03598de..c6ee4c2 100644
--- a/src/report/business-reports/owner-report.scm
+++ b/src/report/business-reports/owner-report.scm
@@ -685,7 +685,7 @@
(gnc:html-table-append-row! table (list
(strftime
date-format
- (localtime (car (gnc:get-today))))))
+ (gnc-localtime (car (gnc:get-today))))))
table))
(define (make-break! document)
diff --git a/src/report/locale-specific/us/taxtxf-de_DE.scm b/src/report/locale-specific/us/taxtxf-de_DE.scm
index 2565cec..fafa1c3 100644
--- a/src/report/locale-specific/us/taxtxf-de_DE.scm
+++ b/src/report/locale-specific/us/taxtxf-de_DE.scm
@@ -101,7 +101,7 @@
(set-tm:isdst result -1)
result))
-(define tax-day (cons (car (mktime bdtm)) 0))
+(define tax-day (cons (gnc-mktime bdtm) 0))
(define after-tax-day (gnc:timepair-later tax-day today))
@@ -322,10 +322,10 @@
(let* ((type (xaccAccountGetType account))
(code (gnc:account-get-txf-code account))
(date-str (if date
- (strftime "%d.%m.%Y" (localtime (car date)))
+ (strftime "%d.%m.%Y" (gnc-localtime (car date)))
#f))
(x-date-str (if x-date
- (strftime "%d.%m.%Y" (localtime (car x-date)))
+ (strftime "%d.%m.%Y" (gnc-localtime (car x-date)))
#f))
;; Only formats 1,3 implemented now! Others are treated as 1.
(format (gnc:get-txf-format code (eq? type ACCT-TYPE-INCOME)))
@@ -410,7 +410,7 @@
(define (render-level-x-account table level max-level account lx-value
suppress-0 full-names txf-date)
(let* ((account-name (if txf-date ; special split
- (strftime "%d.%m.%Y" (localtime (car txf-date)))
+ (strftime "%d.%m.%Y" (gnc-localtime (car txf-date)))
(if (or full-names (equal? level 1))
(gnc-account-get-full-name account)
(xaccAccountGetName account))))
@@ -546,7 +546,7 @@
((4th-est 4th-last) ; Oct 1
(set-tm:mon bdtm 9))))
(set-tm:isdst bdtm -1)
- (cons (car (mktime bdtm)) 0))))
+ (cons (gnc-mktime bdtm) 0))))
(to-value (gnc:timepair-end-day-time
(let ((bdtm from-date))
@@ -589,7 +589,7 @@
(else
(set! bdtm (gnc:timepair->date to-value)))))
(set-tm:isdst bdtm -1)
- (cons (car (mktime bdtm)) 0))))
+ (cons (gnc-mktime bdtm) 0))))
(txf-feedback-str-lst '())
(doc (gnc:make-html-document))
@@ -602,8 +602,8 @@
(txf-special-split? (gnc:account-get-txf-code account)))
(let*
((full-year?
- (let ((bdto (localtime (car to-value)))
- (bdfrom (localtime (car from-value))))
+ (let ((bdto (gnc-localtime (car to-value)))
+ (bdfrom (gnc-localtime (car from-value))))
(and (equal? (tm:year bdto) (tm:year bdfrom))
(equal? (tm:mon bdfrom) 0)
(equal? (tm:mday bdfrom) 1)
@@ -618,7 +618,7 @@
(set-tm:mday bdtm 1) ; 01
(set-tm:mon bdtm 2) ; Mar
(set-tm:isdst bdtm -1)
- (cons (car (mktime bdtm)) 0))
+ (cons (gnc-mktime bdtm) 0))
from-value))
(to-est (if full-year?
(let* ((bdtm (gnc:timepair->date
@@ -628,7 +628,7 @@
(set-tm:mon bdtm 1) ; Feb
(set-tm:year bdtm (+ (tm:year bdtm) 1))
(set-tm:isdst bdtm -1)
- (cons (car (mktime bdtm)) 0))
+ (cons (gnc-mktime bdtm) 0))
to-value)))
(list from-est to-est full-year?))
#f))
@@ -764,11 +764,11 @@
;; Ignore
'())))
- (let ((from-date (strftime "%d.%m.%Y" (localtime (car from-value))))
- (to-date (strftime "%d.%m.%Y" (localtime (car to-value))))
- (to-year (strftime "%Y" (localtime (car to-value))))
+ (let ((from-date (strftime "%d.%m.%Y" (gnc-localtime (car from-value))))
+ (to-date (strftime "%d.%m.%Y" (gnc-localtime (car to-value))))
+ (to-year (strftime "%Y" (gnc-localtime (car to-value))))
(today-date (strftime "%d.%m.%Y"
- (localtime
+ (gnc-localtime
(car (timespecCanonicalDayTime
(cons (current-time) 0))))))
(tax-nr (or
diff --git a/src/report/locale-specific/us/taxtxf.scm b/src/report/locale-specific/us/taxtxf.scm
index 7803e54..67298ca 100644
--- a/src/report/locale-specific/us/taxtxf.scm
+++ b/src/report/locale-specific/us/taxtxf.scm
@@ -132,7 +132,7 @@
(set-tm:isdst result -1)
result))
-(define tax-day (cons (car (mktime bdtm)) 0))
+(define tax-day (cons (gnc-mktime bdtm) 0))
(define after-tax-day (gnc:timepair-later tax-day today))
@@ -552,10 +552,10 @@
(if (and txf?
(not (gnc-numeric-zero-p account-value)))
(let* ((date-str (if date
- (strftime "%m/%d/%Y" (localtime (car date)))
+ (strftime "%m/%d/%Y" (gnc-localtime (car date)))
#f))
(x-date-str (if x-date
- (strftime "%m/%d/%Y" (localtime (car x-date)))
+ (strftime "%m/%d/%Y" (gnc-localtime (car x-date)))
#f))
;; Only formats 1,3,4,6 implemented now! Others are treated as 1.
(format (get-acct-txf-info 'format type code))
@@ -822,7 +822,7 @@
(string-append
" on "
(strftime "%Y-%b-%d"
- (localtime (car pricedb-lookup-price-time)))
+ (gnc-localtime (car pricedb-lookup-price-time)))
")"
)
""))
@@ -975,7 +975,7 @@
"Not Available"))
(list (gnc:make-html-table-cell/markup
"text-cell-center"
- (strftime "%Y-%b-%d" (localtime
+ (strftime "%Y-%b-%d" (gnc-localtime
(car trans-date)))))
(list (gnc:make-html-table-cell/markup
"number-cell-bot"
@@ -1261,7 +1261,7 @@
""
(string-append "Balance on "
(strftime "%Y-%b-%d"
- (localtime (car
+ (gnc-localtime (car
(gnc:timepair-previous-day
from-value))))
(if (string=? curr-conv-note "")
@@ -1495,7 +1495,7 @@
(gnc:make-html-table-cell/markup
"date-cell"
(strftime "%Y-%b-%d"
- (localtime (car trans-date)))))
+ (gnc-localtime (car trans-date)))))
(gnc:html-table-set-style! num-table "table"
'attribute (list "border" "0")
'attribute (list "cellspacing" "0")
@@ -1686,14 +1686,14 @@
#f
(if (txf-beg-bal-only? tax-code)
(string-append "Balance on "
- (strftime "%Y-%b-%d" (localtime (car
+ (strftime "%Y-%b-%d" (gnc-localtime (car
(gnc:timepair-previous-day
from-value))))
" For "
)
(string-append "Balance on "
(strftime "%Y-%b-%d"
- (localtime (car to-value)))
+ (gnc-localtime (car to-value)))
" For "
)
)
@@ -2118,7 +2118,7 @@
((4th-est 4th-last) ; Oct 1
(set-tm:mon bdtm 9))))
(set-tm:isdst bdtm -1)
- (cons (car (mktime bdtm)) 0))))
+ (cons (gnc-mktime bdtm) 0))))
(to-value (gnc:timepair-end-day-time
(let ((bdtm from-date))
@@ -2162,7 +2162,7 @@
(else
(set! bdtm (gnc:timepair->date to-value)))))
(set-tm:isdst bdtm -1)
- (cons (car (mktime bdtm)) 0))))
+ (cons (gnc-mktime bdtm) 0))))
(form-line-acct-header-printed? #f)
(form-schedule-header-printed? #f)
@@ -2179,8 +2179,8 @@
(txf-special-date? (gnc:account-get-txf-code account)))
(let*
((full-year?
- (let ((bdto (localtime (car to-value)))
- (bdfrom (localtime (car from-value))))
+ (let ((bdto (gnc-localtime (car to-value)))
+ (bdfrom (gnc-localtime (car from-value))))
(and (equal? (tm:year bdto) (tm:year bdfrom))
(equal? (tm:mon bdfrom) 0)
(equal? (tm:mday bdfrom) 1)
@@ -2195,7 +2195,7 @@
(set-tm:mday bdtm 1) ; 01
(set-tm:mon bdtm 2) ; Mar
(set-tm:isdst bdtm -1)
- (cons (car (mktime bdtm)) 0))
+ (cons (gnc-mktime bdtm) 0))
from-value))
(to-est (if full-year?
(let* ((bdtm (gnc:timepair->date
@@ -2205,7 +2205,7 @@
(set-tm:mon bdtm 1) ; Feb
(set-tm:year bdtm (+ (tm:year bdtm) 1))
(set-tm:isdst bdtm -1)
- (cons (car (mktime bdtm)) 0))
+ (cons (gnc-mktime bdtm) 0))
to-value)))
(list from-est to-est full-year?))
#f))
@@ -2393,13 +2393,13 @@
) ;; end of let*
)
- (let ((from-date (strftime "%Y-%b-%d" (localtime (car from-value))))
- (to-date (strftime "%Y-%b-%d" (localtime (car to-value))))
+ (let ((from-date (strftime "%Y-%b-%d" (gnc-localtime (car from-value))))
+ (to-date (strftime "%Y-%b-%d" (gnc-localtime (car to-value))))
(today-date (strftime "D%m/%d/%Y"
- (localtime
+ (gnc-localtime
(car (timespecCanonicalDayTime
(cons (current-time) 0))))))
- (tax-year (strftime "%Y" (localtime (car from-value))))
+ (tax-year (strftime "%Y" (gnc-localtime (car from-value))))
(tax-entity-type (gnc-get-current-book-tax-type))
(tax-entity-type-valid? #f)
(prior-form-schedule "")
diff --git a/src/report/report-system/test/test-report-utilities.scm b/src/report/report-system/test/test-report-utilities.scm
index 174f647..d6d26ac 100644
--- a/src/report/report-system/test/test-report-utilities.scm
+++ b/src/report/report-system/test/test-report-utilities.scm
@@ -19,7 +19,7 @@
(define (test-account-get-trans-type-splits-interval)
(let* ((env (create-test-env))
- (ts-now (localtime (current-time)))
+ (ts-now (gnc-localtime (current-time)))
(test-day (tm:mday ts-now))
(test-month (+ 1 (tm:mon ts-now)))
(test-year (+ 1900 (tm:year ts-now)))
diff --git a/src/report/standard-reports/test/test-cash-flow.scm b/src/report/standard-reports/test/test-cash-flow.scm
index 0b6c5a8..47433b0 100644
--- a/src/report/standard-reports/test/test-cash-flow.scm
+++ b/src/report/standard-reports/test/test-cash-flow.scm
@@ -30,7 +30,7 @@
(bank-account (cdr (assoc "Bank" account-alist)))
(wallet-account (cdr (assoc "Wallet" account-alist)))
(expense-account (cdr (assoc "Expenses" account-alist)))
- (today (localtime (current-time)))
+ (today (gnc-localtime (current-time)))
(to-date-tp (gnc-dmy2timespec-end (tm:mday today) (+ 1 (tm:mon today)) (+ 1900 (tm:year today))))
(from-date-tp (NDayDelta to-date-tp 1))
(exchange-fn (lambda (currency amount date) amount))
@@ -66,7 +66,7 @@
(bank-account (cdr (assoc "Bank" account-alist)))
(wallet-account (cdr (assoc "Wallet" account-alist)))
(expense-account (cdr (assoc "Expenses" account-alist)))
- (today (localtime (current-time)))
+ (today (gnc-localtime (current-time)))
(to-date-tp (gnc-dmy2timespec-end (tm:mday today) (+ 1 (tm:mon today)) (+ 1900 (tm:year today))))
(from-date-tp (NDayDelta to-date-tp 1))
(exchange-fn (lambda (currency amount date) amount))
@@ -98,7 +98,7 @@
(bank-account (cdr (assoc "Bank" account-alist)))
(wallet-account (cdr (assoc "Wallet" account-alist)))
(expense-account (cdr (assoc "Expenses" account-alist)))
- (today (localtime (current-time)))
+ (today (gnc-localtime (current-time)))
(to-date-tp (gnc-dmy2timespec-end (tm:mday today) (+ 1 (tm:mon today)) (+ 1900 (tm:year today))))
(from-date-tp (NDayDelta to-date-tp 1))
(exchange-fn (lambda (currency amount date) amount))
diff --git a/src/report/utility-reports/hello-world.scm b/src/report/utility-reports/hello-world.scm
index 118f82c..6cf6109 100644
--- a/src/report/utility-reports/hello-world.scm
+++ b/src/report/utility-reports/hello-world.scm
@@ -273,12 +273,12 @@ option like this.")
;; these are samples of different date options. for a simple
;; date with day, month, and year but no time you should use
;; gnc-print-date
- (let ((time-string (strftime "%X" (localtime (current-time))))
- (date-string (strftime "%x" (localtime (car date-val))))
- (date-string2 (strftime "%x %X" (localtime (car date2-val))))
- (rel-date-string (strftime "%x" (localtime (car rel-date-val))))
+ (let ((time-string (strftime "%X" (gnc-localtime (current-time))))
+ (date-string (strftime "%x" (gnc-localtime (car date-val))))
+ (date-string2 (strftime "%x %X" (gnc-localtime (car date2-val))))
+ (rel-date-string (strftime "%x" (gnc-localtime (car rel-date-val))))
(combo-date-string
- (strftime "%x" (localtime (car combo-date-val)))))
+ (strftime "%x" (gnc-localtime (car combo-date-val)))))
;; Here's where we fill the report document with content. We
;; do this by adding 'html objects' such as text, tables, and
Summary of changes:
src/app-utils/date-utilities.scm | 66 +++++++++++-----------
src/base-typemaps.i | 47 +++++++++++++++
src/engine/Transaction.c | 10 +++-
src/engine/test/test-extras.scm | 8 +--
src/engine/test/test-split.scm | 2 +-
src/import-export/qif-imp/qif-parse.scm | 9 +--
src/import-export/qif-imp/qif-to-gnc.scm | 10 +---
src/report/business-reports/easy-invoice.scm | 2 +-
src/report/business-reports/fancy-invoice.scm | 4 +-
src/report/business-reports/invoice.scm | 2 +-
src/report/business-reports/job-report.scm | 2 +-
src/report/business-reports/owner-report.scm | 2 +-
src/report/locale-specific/us/taxtxf-de_DE.scm | 28 ++++-----
src/report/locale-specific/us/taxtxf.scm | 38 ++++++-------
.../report-system/test/test-report-utilities.scm | 2 +-
.../standard-reports/test/test-cash-flow.scm | 6 +-
src/report/utility-reports/hello-world.scm | 10 ++--
17 files changed, 145 insertions(+), 103 deletions(-)
More information about the gnucash-changes
mailing list