home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 1.ddi / CLIB1.ZIP / GETDATE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  2.4 KB  |  84 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - getdate.c
  3.  *
  4.  * function(s)
  5.  *        getdate - gets MS-DOS date
  6.  *        gettime - gets MS-DOS time
  7.  *-----------------------------------------------------------------------*/
  8.  
  9. /*[]------------------------------------------------------------[]*/
  10. /*|                                                              |*/
  11. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  12. /*|                                                              |*/
  13. /*|                                                              |*/
  14. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  15. /*|     All Rights Reserved.                                     |*/
  16. /*|                                                              |*/
  17. /*[]------------------------------------------------------------[]*/
  18.  
  19. #include <dos.h>
  20.  
  21. /*---------------------------------------------------------------------*
  22.  
  23. Name        getdate - gets MS-DOS date
  24.  
  25. Usage        #include <dos.h>
  26.         void getdate(struct date *dateblk);
  27.  
  28. Prototype in     dos.h
  29.  
  30. Description    getdate fills in the date structure (pointed to by
  31.         dateblk) with the system's current date.
  32.  
  33.         The date structure is defined as follows:
  34.  
  35.         struct date {
  36.             int da_year;    (* Current year *)
  37.             char da_day;    (* Day of the month *)
  38.             char da_mon;    (* Month (1 = Jan) *)
  39.         };
  40.  
  41. Return value    nothing
  42.  
  43. *---------------------------------------------------------------------*/
  44. void _CType getdate(struct date *datep)
  45. {
  46.     _AH = 0x2a;
  47.     geninterrupt(0x21);
  48.     ((int *)datep)[0] = _CX;
  49.     ((int *)datep)[1] = _DX;
  50. }
  51.  
  52.  
  53. /*---------------------------------------------------------------------*
  54.  
  55. Name        gettime - gets MS-DOS time
  56.  
  57. Usage        #include <dos.h>
  58.         void gettime(struct time *timep);
  59.  
  60. Prototype in     dos.h
  61.  
  62. Description    gettime fills in the time structure pointed to by timep
  63.         with the system's current time.
  64.  
  65.         The time structure is defined as follows:
  66.  
  67.         struct time {
  68.             unsigned char ti_min;    (* Minutes *)
  69.             unsigned char ti_hour;    (* Hours *)
  70.             unsigned char ti_hund;    (* Hundredths of seconds *)
  71.             unsigned char ti_sec;    (* Seconds *)
  72.         };
  73.  
  74. Return value    nothing
  75.  
  76. *---------------------------------------------------------------------*/
  77. void _CType gettime(struct time *timep)
  78. {
  79.     _AH = 0x2c;
  80.     geninterrupt(0x21);
  81.     ((int *)timep)[0] = _CX;
  82.     ((int *)timep)[1] = _DX;
  83. }
  84.