gnucash maint: replace guile strftime with gnc-print-time64
Christopher Lam
clam at code.gnucash.org
Tue May 28 06:59:07 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/5873980c (commit)
from https://github.com/Gnucash/gnucash/commit/957df9a3 (commit)
commit 5873980c0cba4a3d0193a81d6028c58f47ae2ac2
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon May 27 22:43:05 2019 +0800
replace guile strftime with gnc-print-time64
addendum to ed42f8ac
guile's strftime is/was buggy; cannot handle non-UTF8 locales. Use
gnc_print_time64 instead. see the following
http://lists.gnu.org/archive/html/bug-guile/2019-05/msg00003.html
diff --git a/gnucash/import-export/qif-imp/qif-parse.scm b/gnucash/import-export/qif-imp/qif-parse.scm
index 5a6ca6453..1a636694d 100644
--- a/gnucash/import-export/qif-imp/qif-parse.scm
+++ b/gnucash/import-export/qif-imp/qif-parse.scm
@@ -643,7 +643,7 @@
(set-tm:mday tm (car date-list))
(set-tm:mon tm (- (cadr date-list) 1))
(set-tm:year tm (- (caddr date-list) 1900))
- (strftime "%a %B %d %Y" tm)))
+ (gnc-print-time64 (gnc-mktime tm) "%a %B %d %Y")))
(define (qif-parse:print-number num)
(with-output-to-string
diff --git a/gnucash/report/business-reports/customer-summary.scm b/gnucash/report/business-reports/customer-summary.scm
index 80df98c12..bb3ec87dc 100644
--- a/gnucash/report/business-reports/customer-summary.scm
+++ b/gnucash/report/business-reports/customer-summary.scm
@@ -270,10 +270,8 @@
(gnc:html-table-append-row! table (list (string-expand
(if addy addy "")
#\newline "<br/>")))
- (gnc:html-table-append-row! table (list
- (strftime
- date-format
- (localtime (gnc:get-today)))))
+ (gnc:html-table-append-row!
+ table (list (gnc-print-time64 (gnc:get-today) date-format)))
(gnc:html-table-set-style!
table-outer "table"
diff --git a/gnucash/report/business-reports/invoice.scm b/gnucash/report/business-reports/invoice.scm
index 0a6db327f..73e53b11c 100644
--- a/gnucash/report/business-reports/invoice.scm
+++ b/gnucash/report/business-reports/invoice.scm
@@ -718,8 +718,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
(string-append label ":")
(gnc:make-html-div/markup
"div-align-right"
- (strftime date-format
- (localtime date)))))
+ (gnc-print-time64 date date-format))))
(define (make-company-table book)
;; single-column table. my name, address, and printdate
diff --git a/gnucash/report/business-reports/job-report.scm b/gnucash/report/business-reports/job-report.scm
index e8a7ef84e..e1901eed4 100644
--- a/gnucash/report/business-reports/job-report.scm
+++ b/gnucash/report/business-reports/job-report.scm
@@ -512,10 +512,8 @@
(gnc:html-table-append-row! table (list (string-expand
(if addy addy "")
#\newline "<br/>")))
- (gnc:html-table-append-row! table (list
- (strftime
- date-format
- (gnc-localtime (current-time)))))
+ (gnc:html-table-append-row!
+ table (list (gnc-print-time64 (current-time) date-format)))
table))
(define (make-break! document)
diff --git a/gnucash/report/business-reports/owner-report.scm b/gnucash/report/business-reports/owner-report.scm
index 787c998ab..8c4284e44 100644
--- a/gnucash/report/business-reports/owner-report.scm
+++ b/gnucash/report/business-reports/owner-report.scm
@@ -722,10 +722,8 @@
(gnc:html-table-append-row! table (list (string-expand
(if addy addy "")
#\newline "<br/>")))
- (gnc:html-table-append-row! table (list
- (strftime
- date-format
- (gnc-localtime (gnc:get-today)))))
+ (gnc:html-table-append-row!
+ table (list (gnc-print-time64 (gnc:get-today) date-format)))
table))
(define (make-break! document)
diff --git a/gnucash/report/business-reports/receipt.eguile.scm b/gnucash/report/business-reports/receipt.eguile.scm
index 60b0150fa..155b42dcd 100644
--- a/gnucash/report/business-reports/receipt.eguile.scm
+++ b/gnucash/report/business-reports/receipt.eguile.scm
@@ -140,7 +140,7 @@
<!-- header texts -->
<h1><?scm:d (nbsp (_ "Invoice No.")) ?> <?scm:d invoiceid ?></h1>
- <h2><?scm:d (strftime opt-date-format (localtime (gnc:get-today))) ?></h2>
+ <h2><?scm:d (gnc-print-time64 (gnc:get-today) opt-date-format) ?></h2>
<p> </p>
<?scm (if (not (string=? billcontact "")) (begin ?>
<p>Attn: <?scm:d billcontact ?></p><br>
diff --git a/gnucash/report/business-reports/taxinvoice.eguile.scm b/gnucash/report/business-reports/taxinvoice.eguile.scm
index 4a81bec0e..70d7b491c 100644
--- a/gnucash/report/business-reports/taxinvoice.eguile.scm
+++ b/gnucash/report/business-reports/taxinvoice.eguile.scm
@@ -252,13 +252,11 @@
<?scm ) (begin ?>
<tr>
<td align="right"><?scm:d (nbsp (_ "Invoice Date")) ?>: </td>
- <td align="right"><?scm:d (nbsp (strftime dateformat
- (localtime postdate))) ?></td>
+ <td align="right"><?scm:d (nbsp (gnc-print-time64 postdate dateformat)) ?></td>
</tr>
<tr>
<td align="right"><?scm:d (nbsp (_ "Due Date")) ?>: </td>
- <td align="right"><?scm:d (nbsp (strftime dateformat
- (localtime duedate))) ?></td>
+ <td align="right"><?scm:d (nbsp (gnc-print-time64 duedate dateformat)) ?></td>
</tr> <?scm )) ?>
<?scm (if (not (string=? billingid "")) (begin ?>
<tr>
diff --git a/gnucash/report/locale-specific/us/taxtxf-de_DE.scm b/gnucash/report/locale-specific/us/taxtxf-de_DE.scm
index 908c8fe3b..26e281f87 100644
--- a/gnucash/report/locale-specific/us/taxtxf-de_DE.scm
+++ b/gnucash/report/locale-specific/us/taxtxf-de_DE.scm
@@ -320,10 +320,10 @@
(let* ((type (xaccAccountGetType account))
(code (gnc:account-get-txf-code account))
(date-str (if date
- (strftime "%d.%m.%Y" (gnc-localtime date))
+ (gnc-print-time64 date "%d.%m.%Y")
#f))
(x-date-str (if x-date
- (strftime "%d.%m.%Y" (gnc-localtime x-date))
+ (gnc-print-time64 x-date "%d.%m.%Y")
#f))
;; Only formats 1,3 implemented now! Others are treated as 1.
(format (gnc:get-txf-format code (eq? type ACCT-TYPE-INCOME)))
@@ -408,7 +408,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" (gnc-localtime txf-date))
+ (gnc-print-time64 txf-date "%d.%m.%Y")
(if (or full-names (equal? level 1))
(gnc-account-get-full-name account)
(xaccAccountGetName account))))
@@ -767,13 +767,11 @@
;; Ignore
'())))
- (let ((from-date (strftime "%d.%m.%Y" (gnc-localtime from-value)))
- (to-date (strftime "%d.%m.%Y" (gnc-localtime to-value)))
- (to-year (strftime "%Y" (gnc-localtime to-value)))
- (today-date (strftime "%d.%m.%Y"
- (gnc-localtime
- (time64CanonicalDayTime
- (current-time)))))
+ (let ((from-date (gnc-print-time64 from-value "%d.%m.%Y"))
+ (to-date (gnc-print-time64 to-value "%d.%m.%Y"))
+ (to-year (gnc-print-time64 to-value "%Y"))
+ (today-date (gnc-print-time64 (time64CanonicalDayTime (current-time))
+ "%d.%m.%Y"))
(tax-nr (unless book
(or
(gnc:option-get-value book gnc:*tax-label* gnc:*tax-nr-label*)
diff --git a/gnucash/report/locale-specific/us/taxtxf.scm b/gnucash/report/locale-specific/us/taxtxf.scm
index 2a61b242b..0a9ce8cdc 100644
--- a/gnucash/report/locale-specific/us/taxtxf.scm
+++ b/gnucash/report/locale-specific/us/taxtxf.scm
@@ -487,10 +487,10 @@
(if (and txf?
(not (gnc-numeric-zero-p account-value)))
(let* ((date-str (if date
- (strftime "%m/%d/%Y" (gnc-localtime date))
+ (gnc-print-time64 date "%m/%d/%Y")
#f))
(x-date-str (if x-date
- (strftime "%m/%d/%Y" (gnc-localtime x-date))
+ (gnc-print-time64 x-date "%m/%d/%Y")
#f))
;; Only formats 1,3,4,6 implemented now! Others are treated as 1.
(format_type (get-acct-txf-info 'format type code))
@@ -758,8 +758,8 @@
)
(string-append
" on "
- (strftime "%Y-%b-%d"
- (gnc-localtime pricedb-lookup-price-time))
+ (gnc-print-time64 pricedb-lookup-price-time
+ "%Y-%b-%d")
")"
)
""))
@@ -912,8 +912,7 @@
"Not Available"))
(list (gnc:make-html-table-cell/markup
"text-cell-center"
- (strftime "%Y-%b-%d" (gnc-localtime
- trans-date))))
+ (gnc-print-time64 trans-date "%Y-%b-%d")))
(list (gnc:make-html-table-cell/markup
"number-cell-bot"
(xaccPrintAmount
@@ -1197,9 +1196,9 @@
(not transaction-details?))
""
(string-append "Balance on "
- (strftime "%Y-%b-%d"
- (gnc-localtime (gnc:time64-previous-day
- from-value)))
+ (gnc-print-time64
+ (gnc:time64-previous-day from-value)
+ "%Y-%b-%d")
(if (string=? curr-conv-note "")
":"
(string-append " " curr-conv-note)
@@ -1430,8 +1429,7 @@
date-table
(gnc:make-html-table-cell/markup
"date-cell"
- (strftime "%Y-%b-%d"
- (gnc-localtime trans-date))))
+ (gnc-print-time64 trans-date "%Y-%b-%d")))
(gnc:html-table-set-style! num-table "table"
'attribute (list "border" "0")
'attribute (list "cellspacing" "0")
@@ -1622,14 +1620,14 @@
#f
(if (txf-beg-bal-only? tax-code)
(string-append "Balance on "
- (strftime "%Y-%b-%d" (gnc-localtime
- (gnc:time64-previous-day
- from-value)))
+ (gnc-print-time64
+ (gnc:time64-previous-day
+ from-value)
+ "%Y-%b-%d")
" For "
)
(string-append "Balance on "
- (strftime "%Y-%b-%d"
- (gnc-localtime to-value))
+ (gnc-print-time64 to-value "%Y-%b-%d")
" For "
)
)
@@ -2328,13 +2326,11 @@
) ;; end of let*
)
- (let ((from-date (strftime "%Y-%b-%d" (gnc-localtime from-value)))
- (to-date (strftime "%Y-%b-%d" (gnc-localtime to-value)))
- (today-date (strftime "D%m/%d/%Y"
- (gnc-localtime
- (time64CanonicalDayTime
- (current-time)))))
- (tax-year (strftime "%Y" (gnc-localtime from-value)))
+ (let ((from-date (gnc-print-time64 from-value "%Y-%b-%d"))
+ (to-date (gnc-print-time64 to-value "%Y-%b-%d"))
+ (today-date (gnc-print-time64 (time64CanonicalDayTime (current-time))
+ "D%m/%d/%Y"))
+ (tax-year (gnc-print-time64 from-value "%Y"))
(tax-entity-type (gnc-get-current-book-tax-type))
(tax-entity-type-valid? #f)
(prior-form-schedule "")
diff --git a/gnucash/report/stylesheets/stylesheet-head-or-tail.scm b/gnucash/report/stylesheets/stylesheet-head-or-tail.scm
index ad755094c..be64e663b 100644
--- a/gnucash/report/stylesheets/stylesheet-head-or-tail.scm
+++ b/gnucash/report/stylesheets/stylesheet-head-or-tail.scm
@@ -463,7 +463,7 @@
(_ "Report Creation Date: ")
(qof-print-date (gnc:get-today))
" "
- (strftime "%X %Z" (localtime (current-time)))
+ (gnc-print-time64 (current-time) "%X %Z")
)
(gnc:html-markup-br)
)
@@ -588,7 +588,7 @@
(_ "Report Creation Date: ")
(qof-print-date (gnc:get-today))
" "
- (strftime "%X %Z" (localtime (current-time)))
+ (gnc-print-time64 (current-time) "%X %Z")
)
(gnc:html-markup-br)
)
diff --git a/gnucash/report/utility-reports/hello-world.scm b/gnucash/report/utility-reports/hello-world.scm
index d14988879..55e8f3c6f 100644
--- a/gnucash/report/utility-reports/hello-world.scm
+++ b/gnucash/report/utility-reports/hello-world.scm
@@ -268,12 +268,11 @@ 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
;; qof-print-date
- (let ((time-string (strftime "%X" (gnc-localtime (current-time))))
- (date-string (strftime "%x" (gnc-localtime date-val)))
- (date-string2 (strftime "%x %X" (gnc-localtime date2-val)))
- (rel-date-string (strftime "%x" (gnc-localtime rel-date-val)))
- (combo-date-string
- (strftime "%x" (gnc-localtime combo-date-val))))
+ (let ((time-string (gnc-print-time64 (current-time) "%X"))
+ (date-string (gnc-print-time64 date-val "%x"))
+ (date-string2 (gnc-print-time64 date2-val "%x %X"))
+ (rel-date-string (gnc-print-time64 rel-date-val "%x"))
+ (combo-date-string (gnc-print-time64 combo-date-val "%x")))
;; 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:
gnucash/import-export/qif-imp/qif-parse.scm | 2 +-
.../report/business-reports/customer-summary.scm | 6 ++--
gnucash/report/business-reports/invoice.scm | 3 +-
gnucash/report/business-reports/job-report.scm | 6 ++--
gnucash/report/business-reports/owner-report.scm | 6 ++--
gnucash/report/business-reports/receipt.eguile.scm | 2 +-
.../report/business-reports/taxinvoice.eguile.scm | 6 ++--
gnucash/report/locale-specific/us/taxtxf-de_DE.scm | 18 +++++-----
gnucash/report/locale-specific/us/taxtxf.scm | 42 ++++++++++------------
.../report/stylesheets/stylesheet-head-or-tail.scm | 4 +--
gnucash/report/utility-reports/hello-world.scm | 11 +++---
11 files changed, 45 insertions(+), 61 deletions(-)
More information about the gnucash-changes
mailing list