home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / dos / prg / sphinx / examples / other / datetime.c__ < prev    next >
Encoding:
Text File  |  1993-12-26  |  953 b   |  57 lines

  1. /*
  2.     NAME:  DATETIME.C--
  3.     DESCRIPTION:  Displays current system date and time.
  4. */
  5.  
  6. ?include "DOS.H--"
  7. ?include "WRITE.H--"
  8.  
  9. byte day,month,wday;
  10. word year;
  11.  
  12. byte hour,minute,second;
  13.  
  14. void main ()
  15. {
  16. @ DOSGETDATE();
  17. day = DL;
  18. month = DH;
  19. year = CX;
  20. wday = AL;
  21.  
  22. WRITESTR("\nCurrent Date: ");
  23. IF( wday == 0 )
  24.     WRITESTR("Sunday ");
  25. ELSE IF( wday == 1 )
  26.     WRITESTR("Monday ");
  27. ELSE IF( wday == 2 )
  28.     WRITESTR("Tuesday ");
  29. ELSE IF( wday == 3 )
  30.     WRITESTR("Wednesday ");
  31. ELSE IF( wday == 4 )
  32.     WRITESTR("Thursday ");
  33. ELSE IF( wday == 5 )
  34.     WRITESTR("Friday ");
  35. ELSE IF( wday == 6 )
  36.     WRITESTR("Saturday ");
  37. WRITEWORD(day);
  38. WRITE('/');
  39. WRITEWORD(month);
  40. WRITE('/');
  41. WRITEWORD(year);
  42.  
  43. @ DOSGETTIME();
  44. hour = CH;
  45. minute = CL;
  46. second = DH;
  47. WRITESTR("\nCurrent Time: ");
  48. WRITEWORD(hour);
  49. WRITE(':');
  50. WRITEWORD(minute);
  51. WRITE(':');
  52. WRITEWORD(second);
  53. WRITELN();
  54. }
  55.  
  56.  
  57. /* end of DATETIME.C-- */