home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p024 / 11.img / BONUS2.LIB / JULIAN.LSP < prev    next >
Encoding:
Text File  |  1993-01-23  |  2.3 KB  |  75 lines

  1. ;;;   Julian.lsp
  2. ;;;   (C) ¬⌐┼v 1988-1992  Autodesk ñ╜Ñq
  3. ;;;
  4. ;;;   Ñ╗╡{ªíñwÑ╤ Autodesk ñ╜Ñq╡∙ÑU¬⌐┼v, ╢╚⌐≤ñU¡z▒í¬pñUÑi▒┬╗P▒zíu│\ÑiívíC
  5. ;;;   ╗╒ñUñú▒oÑHÑ⌠ª≤º╬ªí╡oªµ⌐╬ÑX¬⌐ª╣╡{ªí¬║íu¡∞⌐l╜Xív; ª²ñ╣│\▒zªb»S⌐w¡lÑ═
  6. ;;;   ¬║ñuº@ñW╡▓ªXª╣╡{ªí¬║íuÑ╪¬║╜Xív¿╧Ñ╬íCª│├÷│o├■¡lÑ═ñuº@¬║▒°Ñ≤ªpñU:
  7. ;;;
  8. ;;;   ( i)  │]¡pñW╗Pñuº@ñW¼╥»┬║Θ░w╣∩ Autodesk ñ╜Ñq¬║▓ú½~íC
  9. ;;;   (ii)  ╕ⁿª│íu¬⌐┼v  (C) 1988-1992  Autodesk ñ╜Ñqív¬║¬⌐┼v│qºiíC
  10. ;;;
  11. ;;;
  12. ;;;
  13. ;;;   AUTODESKñ╜Ñq┤ú¿╤ª╣╡{ªí╢╚¿╤º@íu├■ªⁿív¬║░╤ª╥, ª╙ÑBñú▒╞░úª│Ñ⌠ª≤┐∙╗~¬║
  14. ;;;   Ñi»αíCAUTODESKñ╜Ñq»Sª╣º_╗{Ñ⌠ª≤»S⌐wÑ╬│~ñº╛A║┘⌐╩, ÑHñ╬░╙╖~╛P░Γ⌐╥┴⌠ºt
  15. ;;;   ÑX¿π¬║½O├╥íCAUTODESKñ╜ÑqªP«╔ÑτñúÑX¿πª╣╡{ªí░⌡ªµ«╔ñ@⌐wñú╖|íuññ┬_ív⌐╬
  16. ;;;   íuº╣Ñ■╡L╗~ív¬║½O├╥íC
  17. ;;;
  18. ;;;
  19. ;;;   Originally designed and implemented by Kelvin R. Throop
  20. ;;;
  21. ;;;----------------------------------------------------------------------------
  22. ;;; DESCRIPTION
  23. ;;;
  24. ;;;   AutoCAD Julian date to calendar date conversion
  25. ;;;
  26. ;;;----------------------------------------------------------------------------
  27.  
  28. (defun c:date ()
  29.         (setq td (getvar "date"))
  30.         (setq time (* 86400.0 (- td (setq j (fix td)))))
  31.         (setq j (- j 1721119.0))
  32.         (setq y (fix (/ (1- (* 4 j)) 146097.0)))
  33.         (setq j (- (* j 4.0) 1.0 (* 146097.0 y)))
  34.         (setq d (fix (/ j 4.0)))
  35.         (setq j (fix (/ (+ (* 4.0 d) 3.0) 1461.0)))
  36.         (setq d (- (+ (* 4.0 d) 3.0) (* 1461.0 j)))
  37.         (setq d (fix (/ (+ d 4.0) 4.0)))
  38.         (setq m (fix (/ (- (* 5.0 d) 3) 153.0)))
  39.         (setq d (- (* 5.0 d) 3.0 (* 153.0 m)))
  40.         (setq d (fix (/ (+ d 5.0) 5.0)))
  41.         (setq y (+ (* 100.0 y) j))
  42.         (if (< m 10.0)
  43.                 (setq m (+ m 3))
  44.                 (progn
  45.                         (setq m (- m 9))
  46.                         (setq y (1+ y))
  47.                 )
  48.         )
  49.  
  50. ; Now print the date. Year in Y, month in M, day in D
  51.  
  52.         (princ (fix y))
  53.         (princ "/")
  54.         (princ (fix m))
  55.         (princ "/")
  56.         (princ (fix d))
  57.  
  58. ; Determine the clock time from the fraction of the day
  59.  
  60.         (setq hh (fix (/ time 3600.0)))
  61.         (setq time (- time (* hh 3600.00)))
  62.         (setq mm (fix (/ time 60.0)))
  63.         (setq ss (- time (* mm 60.0)))
  64.  
  65. ; Print the time
  66.  
  67.         (princ " ")
  68.         (princ hh)
  69.         (princ ":")
  70.         (princ mm)
  71.         (princ ":")
  72.         (princ ss)
  73.         (terpri)
  74. )
  75.