*---------- program GETXTIME
*           Peter C. Hawxhurst
*           04/04/84
*
* This is a program (command file in dBASE II) to
* retrieve the date and time from the memory of 
* the Osborne Executive computer, set the dBASE II
* date, and display the current date and time.
*
* Hexidecimal conversions may be required to do
* likewise in a BASIC program; memory location
* values shown in this program are decimal.
*
*---------- ACKNOWLEGEMENTS
*
* 1. To myself and others who have need and
*    persistance.
* 2. To Jim Hanlon who gave me the memory locations
*    for the Osborne Executive date as a start. 
*    Jim's tireless direction and support are
*    forever to his credit.
* 3. To algorithms, including portions of those in
*    examples supplied with Ashton Tate's dBASE II
*    that programmers forever supply.
* 4. To Roy Robinson of the Osborne Computer
*    Corporation who lead me to the starting date
*    of the Osborne Exective's date function.
* 5. To those who make creative, beneficial use
*    of this program and pass it along to others.
*
*---------- NOTE
*
*    dBASE II is a trademark of Ashton-Tate.
*    CP/M is a trademark of Digital Research.
*    Osborne Executive is a trademark of Osborne
*    Computer Corporation.
*
*--------- PROGRAM NOTES
*    
*    Memory location 63733 holds the number of
*    256 day periods since the 01/01/78 start
*    date of the Osborne Executive's date function.
*    Memory location 63732 is added to this value
*    to determine the Julien date from 722099
*    (01/01/78).
*
*    Memory locations 63734 & 63735 give values for
*    the hour and minute (63736 holds a value for
*    seconds, if you are intertested).
*
*    The date on the Osborne Executive must be set
*    from CP/M+ using the DATE command before the
*    dBASE II date can automatically be set and
*    this program display the proper date and time.
*
*    The rest is formulamatic and self explanitory.
*
*--------------------------------------------------
*
set talk off
store 722099+peek(63732)+peek(63733)*256 to x
store int(x/365.26)+1 to y
store x+int(395.25-365.25*y) to d
if int(y/4)*4=y
   store 1 to d1
else
   store 2 to d1
endif
if d>(91-d1)
   store d+d1 to d
endif
store int(d/30.57) to m
store d-int(30.57*m) to d
if m>12
   store 1 to m
   store y+1 to y
endif
store y-1900 to y
store str(m,2)+'/'+str(d,2)+'/'+str(y,2) to date
set date to &date
store x+(int(-x/7)*7) to x
if x=0
   store 'Saturday, ' to today
else
   if x=1
      store 'Sunday, ' to today
   else
      if x=2
         store 'Monday, ' to today
      else
         if x=3
            store 'Tuesday, ' to today
         else
            if x=4
               store 'Wednesday, ' to today
            else
               if x=5
                  store 'Thursday, ' to today
               else
                  store 'Friday, ' to today
               endif 5
            endif 4
         endif 3
      endif 2
   endif 1
endif 0
if m=1
   store today+'January 'to today
else
   if m=2
      store today+'February ' to today
   else
      if m=3
         store today+'March ' to today
      else
         if m=4
            store today+'April ' to today
         else
            if m=5
               store today+'May ' to today
            else
               if m=6
                  store today+'June ' to today 
               else
                  if m=7
                     store today+'July ' to today
                  else
                     if m=8
                        store today+'August ' to today
                     else
                        if m=9
                           store today+'September ' to today
                        else
                           if m=10
                              store today+'October ' to today
                           else
                              if m=11
                                 store today+'November ' to today
                              else
                                 store today+'December ' to today
                              endif 11
                           endif 10
                        endif 9
                     endif 8
                  endif 7
               endif 6
            endif 5
         endif 4
      endif 3
   endif 2
endif 1
store today+str(d,2)+', 19'+str(y,2) to today
store peek(63734) to hour
store peek(63735) to min
store hour-6*int(hour/16) to hour
store min-6*int(min/16) to min
if hour>12
   store hour-12 to hour
   store ' p.m. '+today to today
else
   store ' a.m. '+today to today
endif
if min<10
   store '0'+str(min,1) to minute
else
   store str(min,2) to minute
endif
store str(hour,2)+':'+minute+today to today
erase
?
? today
return
