Bug 772369 - Replace use of guile's internal date/time functions

with our own implementation of gnc-date.
This commit is contained in:
John Ralls 2016-12-11 15:23:55 -08:00
parent ad208810f0
commit 78b41f7ac1
15 changed files with 136 additions and 92 deletions

View File

@ -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))))

View File

@ -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;

View File

@ -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)

View File

@ -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)))

View File

@ -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))

View File

@ -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)

View File

@ -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 "&nbsp;")
;;(string-expand (gnc-print-date date) #\space "&nbsp;")
)))
@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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 "")

View File

@ -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)))

View File

@ -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))

View File

@ -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