diff options
Diffstat (limited to 'lisp/calendar')
-rw-r--r-- | lisp/calendar/appt.el | 4 | ||||
-rw-r--r-- | lisp/calendar/cal-bahai.el | 8 | ||||
-rw-r--r-- | lisp/calendar/cal-hebrew.el | 8 | ||||
-rw-r--r-- | lisp/calendar/cal-islam.el | 8 | ||||
-rw-r--r-- | lisp/calendar/calendar.el | 4 | ||||
-rw-r--r-- | lisp/calendar/diary-lib.el | 20 | ||||
-rw-r--r-- | lisp/calendar/solar.el | 86 |
7 files changed, 69 insertions, 69 deletions
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index d007e5b454..c3f29e3d37 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el @@ -633,11 +633,11 @@ hour and minute parts." (min 0)) (string-match "[:.]\\([0-9][0-9]\\)" time2conv) - (setq min (string-to-int + (setq min (string-to-number (match-string 1 time2conv))) (string-match "[0-9]?[0-9][:.]" time2conv) - (setq hr (string-to-int + (setq hr (string-to-number (match-string 0 time2conv))) ;; convert the time appointment time into 24 hour time diff --git a/lisp/calendar/cal-bahai.el b/lisp/calendar/cal-bahai.el index 2bcfaf648e..7e6149d8e9 100644 --- a/lisp/calendar/cal-bahai.el +++ b/lisp/calendar/cal-bahai.el @@ -340,13 +340,13 @@ nongregorian-diary-marking-hook." (buffer-substring (match-beginning m-name-pos) (match-end m-name-pos)))) - (mm (string-to-int + (mm (string-to-number (if m-pos (buffer-substring (match-beginning m-pos) (match-end m-pos)) ""))) - (dd (string-to-int + (dd (string-to-number (if d-pos (buffer-substring (match-beginning d-pos) @@ -365,14 +365,14 @@ nongregorian-diary-marking-hook." (calendar-bahai-from-absolute (calendar-absolute-from-gregorian (calendar-current-date))))) - (y (+ (string-to-int y-str) + (y (+ (string-to-number y-str) (* 100 (/ current-y 100))))) (if (> (- y current-y) 50) (- y 100) (if (> (- current-y y) 50) (+ y 100) y))) - (string-to-int y-str))))) + (string-to-number y-str))))) (if dd-name (mark-calendar-days-named (cdr (assoc-string (substring dd-name 0 3) diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el index f66b4966e5..8f9f7723d5 100644 --- a/lisp/calendar/cal-hebrew.el +++ b/lisp/calendar/cal-hebrew.el @@ -718,13 +718,13 @@ is provided for use as part of the nongregorian-diary-marking-hook." (buffer-substring (match-beginning m-name-pos) (match-end m-name-pos)))) - (mm (string-to-int + (mm (string-to-number (if m-pos (buffer-substring (match-beginning m-pos) (match-end m-pos)) ""))) - (dd (string-to-int + (dd (string-to-number (if d-pos (buffer-substring (match-beginning d-pos) @@ -743,14 +743,14 @@ is provided for use as part of the nongregorian-diary-marking-hook." (calendar-hebrew-from-absolute (calendar-absolute-from-gregorian (calendar-current-date))))) - (y (+ (string-to-int y-str) + (y (+ (string-to-number y-str) (* 100 (/ current-y 100))))) (if (> (- y current-y) 50) (- y 100) (if (> (- current-y y) 50) (+ y 100) y))) - (string-to-int y-str))))) + (string-to-number y-str))))) (if dd-name (mark-calendar-days-named (cdr (assoc-string dd-name diff --git a/lisp/calendar/cal-islam.el b/lisp/calendar/cal-islam.el index 1ac6f0677b..786c71f24c 100644 --- a/lisp/calendar/cal-islam.el +++ b/lisp/calendar/cal-islam.el @@ -337,13 +337,13 @@ provided for use as part of the nongregorian-diary-marking-hook." (buffer-substring (match-beginning m-name-pos) (match-end m-name-pos)))) - (mm (string-to-int + (mm (string-to-number (if m-pos (buffer-substring (match-beginning m-pos) (match-end m-pos)) ""))) - (dd (string-to-int + (dd (string-to-number (if d-pos (buffer-substring (match-beginning d-pos) @@ -362,14 +362,14 @@ provided for use as part of the nongregorian-diary-marking-hook." (calendar-islamic-from-absolute (calendar-absolute-from-gregorian (calendar-current-date))))) - (y (+ (string-to-int y-str) + (y (+ (string-to-number y-str) (* 100 (/ current-y 100))))) (if (> (- y current-y) 50) (- y 100) (if (> (- current-y y) 50) (+ y 100) y))) - (string-to-int y-str))))) + (string-to-number y-str))))) (if dd-name (mark-calendar-days-named (cdr (assoc-string dd-name diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 305ecc1e9b..4575411031 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -2574,7 +2574,7 @@ ERROR is t, otherwise just returns nil." (if (not (looking-at " ")) (re-search-backward "[^0-9]")) (list month - (string-to-int (buffer-substring (1+ (point)) (+ 4 (point)))) + (string-to-number (buffer-substring (1+ (point)) (+ 4 (point)))) year)) (if (looking-at "\\*") (save-excursion @@ -2964,7 +2964,7 @@ calendar window has been prepared." (make-local-variable 'calendar-starred-day) (forward-char 1) (setq calendar-starred-day - (string-to-int + (string-to-number (buffer-substring (point) (- (point) 2)))) (delete-char -2) (insert "**") diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 1832e0cd0f..312b8841cf 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -205,7 +205,7 @@ Valid TYPEs are: string, symbol, int, stringtnil, tnil." (let (ret) (setq ret (cond ((eq type 'string) attrvalue) ((eq type 'symbol) (read attrvalue)) - ((eq type 'int) (string-to-int attrvalue)) + ((eq type 'int) (string-to-number attrvalue)) ((eq type 'stringtnil) (cond ((string= "t" attrvalue) t) ((string= "nil" attrvalue) nil) @@ -908,13 +908,13 @@ diary entries." (buffer-substring-no-properties (match-beginning m-name-pos) (match-end m-name-pos)))) - (mm (string-to-int + (mm (string-to-number (if m-pos (buffer-substring-no-properties (match-beginning m-pos) (match-end m-pos)) ""))) - (dd (string-to-int + (dd (string-to-number (if d-pos (buffer-substring-no-properties (match-beginning d-pos) @@ -931,7 +931,7 @@ diary entries." (let* ((current-y (extract-calendar-year (calendar-current-date))) - (y (+ (string-to-int y-str) + (y (+ (string-to-number y-str) (* 100 (/ current-y 100))))) (if (> (- y current-y) 50) @@ -939,7 +939,7 @@ diary entries." (if (> (- current-y y) 50) (+ y 100) y))) - (string-to-int y-str)))) + (string-to-number y-str)))) (save-excursion (setq entry (buffer-substring-no-properties (point) (line-end-position)) @@ -1149,22 +1149,22 @@ be used instead of a colon (:) to separate the hour and minute parts." (cond ((string-match ; Military time "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" s) - (+ (* 100 (string-to-int + (+ (* 100 (string-to-number (substring s (match-beginning 1) (match-end 1)))) - (string-to-int (substring s (match-beginning 2) (match-end 2))))) + (string-to-number (substring s (match-beginning 2) (match-end 2))))) ((string-match ; Hour only XXam or XXpm "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)\\([ap]\\)m\\>" s) - (+ (* 100 (% (string-to-int + (+ (* 100 (% (string-to-number (substring s (match-beginning 1) (match-end 1))) 12)) (if (equal ?a (downcase (aref s (match-beginning 2)))) 0 1200))) ((string-match ; Hour and minute XX:XXam or XX:XXpm "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]\\([0-9][0-9]\\)\\([ap]\\)m\\>" s) - (+ (* 100 (% (string-to-int + (+ (* 100 (% (string-to-number (substring s (match-beginning 1) (match-end 1))) 12)) - (string-to-int (substring s (match-beginning 2) (match-end 2))) + (string-to-number (substring s (match-beginning 2) (match-end 2))) (if (equal ?a (downcase (aref s (match-beginning 3)))) 0 1200))) (t diary-unknown-time)))) ; Unrecognizable diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el index 5eca356af5..8401aeb9bf 100644 --- a/lisp/calendar/solar.el +++ b/lisp/calendar/solar.el @@ -227,7 +227,7 @@ Needed for polar areas, in order to know whether the day lasts 0 or 24 hours.") Returns nil if nothing was entered." (let ((x (read-string prompt ""))) (if (not (string-equal x "")) - (string-to-int x)))) + (string-to-number x)))) ;; The condition-case stuff is needed to catch bogus arithmetic ;; exceptions that occur on some machines (like Sparcs) @@ -643,48 +643,6 @@ since January 1st, 2000, at 12 ET." ; equation of time, in hours (list app i time-eq nut))) -(defun solar-longitude (d) - "Longitude of sun on astronomical (Julian) day number D. -Accurary is about 0.0006 degree (about 365.25*24*60*0.0006/360 = 1 minutes). - -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 are used to interpret local time." - (let* ((a-d (calendar-absolute-from-astro d)) - ;; get Universal Time - (date (calendar-astro-from-absolute - (- a-d - (if (dst-in-effect a-d) - (/ calendar-daylight-time-offset 24.0 60.0) 0) - (/ calendar-time-zone 60.0 24.0)))) - ;; get Ephemeris Time - (date (+ date (solar-ephemeris-correction - (extract-calendar-year - (calendar-gregorian-from-absolute - (floor - (calendar-absolute-from-astro - date))))))) - (U (/ (- date 2451545) 3652500)) - (longitude - (+ 4.9353929 - (* 62833.1961680 U) - (* 0.0000001 - (apply '+ - (mapcar '(lambda (x) - (* (car x) - (sin (mod - (+ (car (cdr x)) - (* (car (cdr (cdr x))) U)) - (* 2 pi))))) - solar-data-list))))) - (aberration - (* 0.0000001 (- (* 17 (cos (+ 3.10 (* 62830.14 U)))) 973))) - (A1 (mod (+ 2.18 (* U (+ -3375.70 (* 0.36 U)))) (* 2 pi))) - (A2 (mod (+ 3.51 (* U (+ 125666.39 (* 0.10 U)))) (* 2 pi))) - (nutation (* -0.0000001 (+ (* 834 (sin A1)) (* 64 (sin A2)))))) - (mod (radians-to-degrees (+ longitude aberration nutation)) 360.0))) - (defconst solar-data-list '((403406 4.721964 1.621043) (195207 5.937458 62830.348067) @@ -737,6 +695,48 @@ calendar-time-zone are used to interpret local time." (10 1.50 21463.25) (10 2.55 157208.40))) +(defun solar-longitude (d) + "Longitude of sun on astronomical (Julian) day number D. +Accurary is about 0.0006 degree (about 365.25*24*60*0.0006/360 = 1 minutes). + +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 are used to interpret local time." + (let* ((a-d (calendar-absolute-from-astro d)) + ;; get Universal Time + (date (calendar-astro-from-absolute + (- a-d + (if (dst-in-effect a-d) + (/ calendar-daylight-time-offset 24.0 60.0) 0) + (/ calendar-time-zone 60.0 24.0)))) + ;; get Ephemeris Time + (date (+ date (solar-ephemeris-correction + (extract-calendar-year + (calendar-gregorian-from-absolute + (floor + (calendar-absolute-from-astro + date))))))) + (U (/ (- date 2451545) 3652500)) + (longitude + (+ 4.9353929 + (* 62833.1961680 U) + (* 0.0000001 + (apply '+ + (mapcar '(lambda (x) + (* (car x) + (sin (mod + (+ (car (cdr x)) + (* (car (cdr (cdr x))) U)) + (* 2 pi))))) + solar-data-list))))) + (aberration + (* 0.0000001 (- (* 17 (cos (+ 3.10 (* 62830.14 U)))) 973))) + (A1 (mod (+ 2.18 (* U (+ -3375.70 (* 0.36 U)))) (* 2 pi))) + (A2 (mod (+ 3.51 (* U (+ 125666.39 (* 0.10 U)))) (* 2 pi))) + (nutation (* -0.0000001 (+ (* 834 (sin A1)) (* 64 (sin A2)))))) + (mod (radians-to-degrees (+ longitude aberration nutation)) 360.0))) + (defun solar-ephemeris-correction (year) "Ephemeris time minus Universal Time during Gregorian year. Result is in days. |