summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
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