From 72768b659f7957e4c4edc4c05087c65dfa333b98 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 27 Jun 2020 12:27:42 +0200 Subject: [PATCH] Print result of `db/ntp-to-time' when called interactively Otherwise no result is displayed. --- site-lisp/db-utils.el | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/site-lisp/db-utils.el b/site-lisp/db-utils.el index 8414769..5733d28 100644 --- a/site-lisp/db-utils.el +++ b/site-lisp/db-utils.el @@ -201,21 +201,24 @@ FORMAT-STRING defaults to some ISO 8601-like format." 'raw) ;; we explicitly call `calcFunc-unixtime' ;; here to set the time zone to UTC - 0))) - (format (or format-string - "%04d-%02d-%02dT%02d:%02d:%012.9fZ") - (calcFunc-year unix-time) - (calcFunc-month unix-time) - (calcFunc-day unix-time) - (calcFunc-hour unix-time) - (calcFunc-minute unix-time) - ;; `seconds' will be a floating point number, and we need to format - ;; it with a precision that is high enough; apparently, we also need - ;; to truncate the number of seconds to nine digits, at least that - ;; is what has been done in the test example we use in the - ;; corresponding regression test … - (string-to-number - (calc-eval "trunc(second($), 9)" 'num unix-time))))) + 0)) + (time-string (format (or format-string + "%04d-%02d-%02dT%02d:%02d:%012.9fZ") + (calcFunc-year unix-time) + (calcFunc-month unix-time) + (calcFunc-day unix-time) + (calcFunc-hour unix-time) + (calcFunc-minute unix-time) + ;; `seconds' will be a floating point number, and we need to format + ;; it with a precision that is high enough; apparently, we also need + ;; to truncate the number of seconds to nine digits, at least that + ;; is what has been done in the test example we use in the + ;; corresponding regression test … + (string-to-number + (calc-eval "trunc(second($), 9)" 'num unix-time))))) + (if (called-interactively-p 'interactive) + (message time-string) + time-string))) (defun conditionally-enable-lispy () "Enable lispy-mode when in `eval-expression’ or in