Function: lunar-new-moon-on-or-after

lunar-new-moon-on-or-after is a byte-compiled function defined in lunar.el.gz.

Signature

(lunar-new-moon-on-or-after D)

Documentation

Julian day number of first new moon on or after Julian day number D.

The fractional part is the time of day.

The date and time are local time, including any daylight saving rules, as governed by the values of calendar-daylight-savings-starts, calendar-daylight-savings-starts-time, calendar-daylight-savings-ends, calendar-daylight-savings-ends-time, calendar-daylight-time-offset, and calendar-time-zone.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/lunar.el.gz
(defun lunar-new-moon-on-or-after (d)
  "Julian day number of first new moon on or after Julian day number D.
The fractional part is the time of day.

The date and time are local time, including any daylight saving rules,
as governed by the values of `calendar-daylight-savings-starts',
`calendar-daylight-savings-starts-time', `calendar-daylight-savings-ends',
`calendar-daylight-savings-ends-time', `calendar-daylight-time-offset', and
`calendar-time-zone'."
  (let* ((date (calendar-gregorian-from-absolute
                (floor (calendar-astro-to-absolute d))))
         (year (+ (calendar-extract-year date)
                  (/ (calendar-day-number date) 365.25)))
         (k (floor (* (- year 2000.0) lunar-cycles-per-year)))
         (date (lunar-new-moon-time k))
         (a-date (progn
                   (while (< date d)
                     (setq k (1+ k)
                           date (lunar-new-moon-time k)))
                   (calendar-astro-to-absolute date)))
         (time (* 24 (- a-date (truncate a-date))))
         (date (calendar-gregorian-from-absolute (truncate a-date)))
         (adj (dst-adjust-time date time)))
    (calendar-astro-from-absolute
     (+ (calendar-absolute-from-gregorian (car adj))
        (/ (cadr adj) 24.0)))))