summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-14 02:22:11 +0200
committerThanos Apollo <[email protected]>2023-12-14 02:22:11 +0200
commite4f9ee8d25273f75d969cded84019baea07883f7 (patch)
treec499f2159671425fe5f44d85dc5ef01b7d7e718a /gnosis.el
parente9f1c48395f19a1988bcf3d16ca8b292a76313e0 (diff)
Add #'(gnosis-current-date)
Get current date in (yyyy mm dd) & add offset. Inspired by calendar-current-date func Changed format to (year month day)
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index 6fbaf5b..ff5085e 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -236,6 +236,19 @@ Used to calcuate new interval for failed questions."
:group 'gnosis
:type 'float)
+(defun gnosis-current-date (&optional offset)
+ "Return the current date in a list (year month day).
+Optional integer OFFSET is a number of days from the current date."
+ (let* ((now (decode-time))
+ (now (list (decoded-time-month now)
+ (decoded-time-day now)
+ (decoded-time-year now))))
+ (let ((date (if (zerop (or offset 0))
+ now
+ (calendar-gregorian-from-absolute
+ (+ offset (calendar-absolute-from-gregorian now))))))
+ (list (nth 2 date) (nth 0 date) (nth 1 date)))))
+
(defun gnosis-calculate-e-factor (ef quality)
"Calculate new e-factor given existing EF and binary QUALITY, 0 or 1."
(cond