• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/calendar/

Lines Matching +defs:calendar +defs:date +defs:string

1 ;;; solar.el --- calendar functions for solar events
9 ;; Keywords: calendar
10 ;; Human-Keywords: sunrise, sunset, equinox, solstice, calendar, diary,
32 ;; This collection of functions implements the features of calendar.el,
58 (defvar date)
70 (defcustom calendar-time-display-form
76 `12-hours', `24-hours', and `minutes', all numbers in string form,
86 :group 'calendar)
89 (defcustom calendar-latitude nil
90 "*Latitude of `calendar-location-name' in degrees.
106 :group 'calendar)
109 (defcustom calendar-longitude nil
110 "*Longitude of `calendar-location-name' in degrees.
126 :group 'calendar)
128 (defsubst calendar-latitude ()
129 "Convert calendar-latitude to a signed decimal fraction, if needed."
130 (if (numberp calendar-latitude)
131 calendar-latitude
132 (let ((lat (+ (aref calendar-latitude 0)
133 (/ (aref calendar-latitude 1) 60.0))))
134 (if (equal (aref calendar-latitude 2) 'north)
138 (defsubst calendar-longitude ()
139 "Convert calendar-longitude to a signed decimal fraction, if needed."
140 (if (numberp calendar-longitude)
141 calendar-longitude
142 (let ((long (+ (aref calendar-longitude 0)
143 (/ (aref calendar-longitude 1) 60.0))))
144 (if (equal (aref calendar-longitude 2) 'east)
149 (defcustom calendar-location-name
152 (if (numberp calendar-latitude)
153 (abs calendar-latitude)
154 (+ (aref calendar-latitude 0)
155 (/ (aref calendar-latitude 1) 60.0)))
156 (if (numberp calendar-latitude)
157 (if (> calendar-latitude 0) "N" "S")
158 (if (equal (aref calendar-latitude 2) 'north) "N" "S"))
159 (if (numberp calendar-longitude)
160 (abs calendar-longitude)
161 (+ (aref calendar-longitude 0)
162 (/ (aref calendar-longitude 1) 60.0)))
163 (if (numberp calendar-longitude)
164 (if (> calendar-longitude 0) "E" "W")
165 (if (equal (aref calendar-longitude 2) 'east) "E" "W"))))
166 "*Expression evaluating to name of `calendar-longitude', `calendar-latitude'.
172 :group 'calendar)
187 :group 'calendar)
208 (if (not calendar-longitude)
209 (setq calendar-longitude
212 (if (not calendar-latitude)
213 (setq calendar-latitude
216 (if (not calendar-time-zone)
217 (setq calendar-time-zone
224 (let ((x (read-string prompt "")))
225 (if (not (string-equal x ""))
226 (string-to-number x))))
328 (list (if rise-time (+ rise-time (/ calendar-time-zone 60.0)) nil)
329 (if set-time (+ set-time (/ calendar-time-zone 60.0)) nil)
383 (defun solar-time-string (time time-zone)
385 Format used is given by `calendar-time-display-form'."
392 (mapconcat 'eval calendar-time-display-form "")))
401 (defun solar-exact-local-noon (date)
402 "Date and Universal Time of local noon at *local date* date.
404 The date may be different from the one asked for, but it will be the right
405 local date. The second component of date should be an integer."
406 (let* ((nd date)
407 (ut (- 12.0 (/ (calendar-longitude) 15)))
408 (te (solar-time-equation date ut)))
412 (setq nd (list (car date) (+ 1 (car (cdr date)))
413 (car (cdr (cdr date)))))
417 (setq nd (list (car date) (- (car (cdr date)) 1)
418 (car (cdr (cdr date)))))
420 (setq nd (calendar-gregorian-from-absolute
421 (calendar-absolute-from-gregorian nd)))
422 ; date standardization
425 (defun solar-sunrise-sunset (date)
430 (exact-local-noon (solar-exact-local-noon date))
441 (calendar-longitude) 0)))
452 (calendar-latitude)
453 (calendar-longitude) -0.61)))
455 (adj-rise (if rise (dst-adjust-time date rise) nil))
457 (adj-set (if set (dst-adjust-time date set) nil))
460 (and rise (calendar-date-equal date (car adj-rise)) (cdr adj-rise))
461 (and set (calendar-date-equal date (car adj-set)) (cdr adj-set))
464 (defun solar-sunrise-sunset-string (date)
466 (let ((l (solar-sunrise-sunset date)))
470 (concat "Sunrise " (apply 'solar-time-string (car l)))
473 (concat "sunset " (apply 'solar-time-string (car (cdr l))))
475 (eval calendar-location-name)
478 (defun solar-julian-ut-centuries (date)
480 (/ (- (calendar-absolute-from-gregorian date)
481 (calendar-absolute-from-gregorian '(1 1.5 2000)))
501 (defun solar-date-next-longitude (d l)
503 multiple of L degrees at calendar-location-name with that location's
510 The values of calendar-daylight-savings-starts,
511 calendar-daylight-savings-starts-time, calendar-daylight-savings-ends,
512 calendar-daylight-savings-ends-time, calendar-daylight-time-offset, and
513 calendar-time-zone are used to interpret local time."
552 (ah (- (* st 15) (* 15 (car ec)) (* -1 (calendar-longitude))))
698 The values of calendar-daylight-savings-starts,
699 calendar-daylight-savings-starts-time, calendar-daylight-savings-ends,
700 calendar-daylight-savings-ends-time, calendar-daylight-time-offset, and
701 calendar-time-zone are used to interpret local time."
702 (let* ((a-d (calendar-absolute-from-astro d))
704 (date (calendar-astro-from-absolute
707 (/ calendar-daylight-time-offset 24.0 60.0) 0)
708 (/ calendar-time-zone 60.0 24.0))))
710 (date (+ date (solar-ephemeris-correction
711 (extract-calendar-year
712 (calendar-gregorian-from-absolute
714 (calendar-absolute-from-astro
715 date)))))))
716 (U (/ (- date 2451545) 3652500))
745 (let* ((theta (/ (- (calendar-astro-from-absolute
746 (calendar-absolute-from-gregorian
748 (calendar-astro-from-absolute
749 (calendar-absolute-from-gregorian
765 (let* ((theta (/ (- (calendar-astro-from-absolute
766 (calendar-absolute-from-gregorian
768 (calendar-astro-from-absolute
769 (calendar-absolute-from-gregorian
790 (t (let* ((tmp (- (calendar-astro-from-absolute
791 (calendar-absolute-from-gregorian
815 (defun solar-time-equation (date ut)
817 (let* ((et (solar-date-to-et date ut))
821 (defun solar-date-to-et (date ut)
824 (let ((t0 (solar-julian-ut-centuries date)))
830 If called with an optional prefix argument, prompt for date.
833 latitude, time zone, and date, and always use standard time.
839 (not (and calendar-latitude calendar-longitude calendar-time-zone)))
841 (let* ((calendar-longitude
842 (if (< arg 16) calendar-longitude
845 (calendar-latitude
846 (if (< arg 16) calendar-latitude
849 (calendar-time-zone
850 (if (< arg 16) calendar-time-zone
853 (calendar-location-name
854 (if (< arg 16) calendar-location-name
857 (if (numberp calendar-latitude)
858 (abs calendar-latitude)
859 (+ (aref calendar-latitude 0)
860 (/ (aref calendar-latitude 1) 60.0)))
861 (if (numberp calendar-latitude)
862 (if (> calendar-latitude 0) "N" "S")
863 (if (equal (aref calendar-latitude 2) 'north) "N" "S"))
864 (if (numberp calendar-longitude)
865 (abs calendar-longitude)
866 (+ (aref calendar-longitude 0)
867 (/ (aref calendar-longitude 1) 60.0)))
868 (if (numberp calendar-longitude)
869 (if (> calendar-longitude 0) "E" "W")
870 (if (equal (aref calendar-longitude 2) 'east)
872 (calendar-standard-time-zone-name
873 (if (< arg 16) calendar-standard-time-zone-name
874 (cond ((= calendar-time-zone 0) "UTC")
875 ((< calendar-time-zone 0)
876 (format "UTC%dmin" calendar-time-zone))
877 (t (format "UTC+%dmin" calendar-time-zone)))))
878 (calendar-daylight-savings-starts
879 (if (< arg 16) calendar-daylight-savings-starts))
880 (calendar-daylight-savings-ends
881 (if (< arg 16) calendar-daylight-savings-ends))
882 (date (if (< arg 4) (calendar-current-date) (calendar-read-date)))
883 (date-string (calendar-date-string date t))
884 (time-string (solar-sunrise-sunset-string date))
885 (msg (format "%s: %s" date-string time-string))
890 (princ (concat date-string "\n" time-string)))
899 (defun calendar-sunrise-sunset ()
900 "Local time of sunrise and sunset for date under cursor.
903 (if (not (and calendar-latitude calendar-longitude calendar-time-zone))
905 (let ((date (calendar-cursor-to-date t)))
907 (calendar-date-string date t t)
908 (solar-sunrise-sunset-string date))))
913 (if (not (and calendar-latitude calendar-longitude calendar-time-zone))
915 (solar-sunrise-sunset-string date))
924 "Local time of candle lighting diary entry--applies if date is a Friday.
925 No diary entry if there is no sunset on that date.
927 An optional parameter MARK specifies a face or single-character string to
928 use when highlighting the day in the calendar."
929 (if (not (and calendar-latitude calendar-longitude calendar-time-zone))
931 (if (= (% (calendar-absolute-from-gregorian date) 7) 5);; Friday
932 (let* ((sunset (car (cdr (solar-sunrise-sunset date))))
940 (apply 'solar-time-string light)))))))
973 RESULT is a gregorian local date.
990 (date (calendar-gregorian-from-absolute (floor (- JD 1721424.5))))
993 (list (car date) (+ (car (cdr date)) time
994 (/ (/ calendar-time-zone 60.0) 24.0))
995 (car (cdr (cdr date))))))
1049 "*local* date and time of equinoxes and solstices, if visible in the calendar window.
1053 (increment-calendar-month m y (cond ((= 1 (% m 3)) -1)
1056 (let* ((calendar-standard-time-zone-name
1057 (if calendar-time-zone calendar-standard-time-zone-name "UTC"))
1058 (calendar-daylight-savings-starts
1059 (if calendar-time-zone calendar-daylight-savings-starts))
1060 (calendar-daylight-savings-ends
1061 (if calendar-time-zone calendar-daylight-savings-ends))
1062 (calendar-time-zone (if calendar-time-zone calendar-time-zone 0))
1073 ;(d0 (solar-date-next-longitude
1074 ; (calendar-astro-from-absolute
1075 ; (calendar-absolute-from-gregorian
1078 ;(abs-day (calendar-absolute-from-astro d)))
1079 (abs-day (calendar-absolute-from-gregorian d)))
1081 (list (calendar-gregorian-from-absolute (floor abs-day))
1083 (nth k (if (and calendar-latitude
1084 (< (calendar-latitude) 0))
1087 (solar-time-string
1090 calendar-daylight-time-zone-name
1091 calendar-standard-time-zone-name))))))))