home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 1 / FishNMoreVol1.bin / more / code_examples / librar / grabdate.c < prev    next >
Text File  |  1989-02-08  |  1KB  |  39 lines

  1. /*--------------------------------------*/
  2. /*                    */
  3. /*               GRABDATE(X)        */
  4. /*                    */
  5. /* Functionality:            */
  6. /*    Gets the system date.        */
  7. /* Arguments:                */
  8. /*    0: The date array that the    */
  9. /*       system date is put in.    */
  10. /* Returns: Nothing            */
  11. /* Functions used:            */
  12. /*      INT86()                */
  13. /* Author: John Callicotte        */
  14. /* Date created/modified: 09/01/88    */
  15. /*                    */
  16. /*--------------------------------------*/
  17.  
  18. # include "dos.h"
  19. void grabdate(aa)
  20. char aa[8];
  21. {
  22.     union REGS outt;
  23.         int d;
  24.         outt.x.ax=256*42;    /* Put 42 in AH register. (DOS function 42) */
  25.  
  26.         int86(33,&outt,&outt);  /* Make the DOS call. */
  27.  
  28.         aa[6]=((outt.x.cx-1900)/10)+48;    /* Register CX has the year. */
  29.         aa[7]=((outt.x.cx-1900)-((aa[6]-48)*10))+48;
  30.  
  31.         aa[0]=((outt.x.dx/256)/10)+48;    /* Register DX has the month. */
  32.         aa[1]=((outt.x.dx/256)-((aa[0]-48)*10))+48;
  33.  
  34.         d=outt.x.dx-256*(outt.x.dx/256);
  35.         aa[3]=(d/10)+48;
  36.         aa[4]=(d-((aa[3]-48)*10))+48;
  37.     aa[2]=aa[5]=47;
  38. }
  39.