home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / apr94cad.zip / TIP957X.LSP < prev    next >
Lisp/Scheme  |  1994-03-11  |  4KB  |  183 lines

  1. ; TIP957x.LSP: TIME.LSP [REVISED]    (c)1994, Tony Rogers 
  2. ; Revised to work with non-Novell network systems
  3.  
  4. (defun C:T ()
  5.    (setq time (rtos (getvar "CDATE") 2 6)   ;Gets Julian date.
  6.       hr (substr time 10 2)                 ;Hours.
  7.       m  (substr time 12 2)                 ;Minutes.
  8.    )
  9.    (setq date (rtos (getvar "CDATE") 2 6)   ;Gets Julian date.
  10.  
  11.  
  12. ;;********START REVISE_1
  13.       yr (atof (substr date 1 4))                  ;Year.   <add atof>
  14.       mo (atof (substr date 5 2))           ;Month.   <change to atof>
  15.       day (atof (substr date 7 2))          ;Day.  <change to atof>
  16.    )
  17.    (setq day_f day)                                  ; <set day_f to day before changing
  18. ;;********STOP REVISE_1
  19.  
  20.  
  21. (setq day (fix day))                     ;Fixes day to read 5, not 05.
  22.    (setq day (itoa day))
  23.    (setq t (atoi (strcat hr m)))
  24.    (setq hr (atoi hr))                      ;Adjusts time if past 12:00.
  25.    (if
  26.       (> hr 12)
  27.       (setq hr (- hr 12))
  28.    )
  29.    (setq hr (itoa hr))
  30.    (setq t1 (strcat hr ":" m))              ;Strings together hour & minutes.
  31.    (progn
  32.       (if                                   ;Sets greeting for morning.
  33.          (< t 1200)
  34.          (setq greet "Good morning.")
  35.       )
  36.       (if                                   ;Sets greeting for afternoon.
  37.          (and
  38.             (>= t 1200) (< t 1800)
  39.          )
  40.          (setq greet "Good afternoon.")
  41.       )
  42.       (if                                   ;Sets greeting for evening.
  43.          (and
  44.             (>= t 1800) (< t 2400)
  45.          )
  46.          (setq greet "Good evening.")
  47.       )
  48.    )
  49.    (progn
  50.       (if                                   ;Sets time for am.
  51.          (< t 1200)
  52.          (setq t2 "am")
  53.       )
  54.       (if                                   ;Sets time for pm.
  55.          (> t 1200)
  56.          (setq t2 "pm")
  57.       )
  58.    )
  59.    (setq t3 (strcat t1 " " t2))             ;Strings together time and 
  60.    ; am or pm.
  61.  
  62.  
  63. ;;********START REVISE_2
  64. ;;ADD FOLLOWING LINES
  65.    
  66.     (setq N (if (<= MO 2)
  67.     (+ (fix (* (+ MO 13)30.6))(fix (* (- YR 1)365.25)) DAY_F)
  68.     (+ (fix (* (+ MO  1)30.6))(fix (* YR 365.25)) DAY_F)
  69.            )
  70.   )
  71.  
  72.    (setq yr (rtos yr 2 0))
  73.    (setq day_s day)
  74.  
  75.    (setq DAY (rem (- N 2) 7)) ; modulo 7 from Sun.,12/30/1900
  76.     (setq DAY (rtos DAY 2 0))
  77. ;;********STOP REVISE_2
  78.  
  79.  
  80.    (if                                   ;Sets day name.
  81.       (= day "1")
  82.       (setq day2 "Monday")
  83.    )
  84.    (if                                   
  85.       (= day "2")
  86.       (setq day2 "Tuesday")
  87.    )
  88.    (if                                   
  89.       (= day "3")
  90.       (setq day2 "Wednesday")
  91.    )
  92.    (if                                   
  93.       (= day "4")
  94.       (setq day2 "Thursday")
  95.    )
  96.    (if                                   
  97.       (= day "5")
  98.       (setq day2 "Friday")
  99.    )
  100.    (if                                   
  101.       (= day "6")
  102.       (setq day2 "Saturday")
  103.    )
  104.    (if                                   
  105.  
  106.  
  107. ;;********START REVISE_3
  108.       (= day "0")         ;;<change 1 to 0>
  109. ;;********STOP REVISE_3 
  110.  
  111.  
  112.      (setq day2 "Sunday")
  113.    )
  114.  
  115.    (if                                   ;Sets month name.
  116.       (= mo 01)
  117.       (setq mo1 "January")
  118.    )
  119.    (if
  120.       (= mo 02)
  121.       (setq mo1 "February")
  122.    )
  123.    (if
  124.       (= mo 03)
  125.       (setq mo1 "March")
  126.    )
  127.    (if
  128.       (= mo 04)
  129.       (setq mo1 "April")
  130.    )
  131.    (if
  132.       (= mo 05)
  133.       (setq mo1 "May")
  134.    )
  135.    (if
  136.       (= mo 06)
  137.       (setq mo1 "June")
  138.    )
  139.    (if
  140.       (= mo 07)
  141.       (setq mo1 "July")
  142.    )
  143.    (if
  144.       (= mo 08)
  145.       (setq mo1 "August")
  146.    )
  147.    (if
  148.       (= mo 09)
  149.       (setq mo1 "September")
  150.    )
  151.    (if
  152.       (= mo 10)
  153.       (setq mo1 "October")
  154.    )
  155.    (if
  156.       (= mo 11)
  157.       (setq mo1 "November")
  158.    )
  159.    (if
  160.       (= mo 12)
  161.       (setq mo1 "December")
  162.    )
  163.  
  164.  
  165.  
  166. ;;START REVISE_4
  167.   (setq date1 (strcat mo1 " " day_s ", " yr));Strings together date.<CHANGE DAY TO DAY_S>
  168. ;;STOP REVISE_4 
  169.  
  170.  
  171.   (setq date2 (strcat day2 ", " date1 "  " t3));Strings together day, 
  172.    ; date & time.
  173.    (princ "\n")                                ;Prints greeting on screen.
  174.    (princ greet)
  175.    (princ "\nIt is ")                          ;Prints date & time on screen.
  176.    (princ date2)
  177.    (princ ".")
  178.    (princ)
  179. ); end time.lsp REVISED
  180.  
  181.  
  182.  
  183.