Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.7 KiB

  1. /*************************************************************************
  2. *
  3. * DATE.C
  4. *
  5. * NT date routine
  6. *
  7. * Copyright (c) 1995 Microsoft Corporation
  8. *
  9. * $Log: N:\NT\PRIVATE\NW4\NWSCRIPT\VCS\DATE.C $
  10. *
  11. * Rev 1.2 10 Apr 1996 14:22:00 terryt
  12. * Hotfix for 21181hq
  13. *
  14. * Rev 1.2 12 Mar 1996 19:52:56 terryt
  15. * Relative NDS names and merge
  16. *
  17. * Rev 1.1 22 Dec 1995 14:24:04 terryt
  18. * Add Microsoft headers
  19. *
  20. * Rev 1.0 15 Nov 1995 18:06:40 terryt
  21. * Initial revision.
  22. *
  23. * Rev 1.0 15 May 1995 19:10:22 terryt
  24. * Initial revision.
  25. *
  26. *************************************************************************/
  27. #include <stdio.h>
  28. #include <direct.h>
  29. #include <time.h>
  30. #include <stdlib.h>
  31. #include <nt.h>
  32. #include <ntrtl.h>
  33. #include <nturtl.h>
  34. #include <windows.h>
  35. #include "nwscript.h"
  36. /*
  37. *******************************************************************
  38. NTGetTheDate
  39. Routine Description:
  40. Return the current date
  41. Arguments:
  42. yearCurrent pointer to current year
  43. 1980-2099
  44. monthCurrent pointer to current month
  45. 1-12
  46. dayCurrent pointer to current day
  47. 1-31
  48. Return Value:
  49. *******************************************************************
  50. */
  51. void NTGetTheDate( unsigned int * yearCurrent,
  52. unsigned char * monthCurrent,
  53. unsigned char * dayCurrent )
  54. {
  55. time_t timedat;
  56. struct tm * p_tm;
  57. (void) time( &timedat );
  58. p_tm = localtime( &timedat );
  59. *yearCurrent = p_tm->tm_year + 1900;
  60. *monthCurrent = p_tm->tm_mon + 1;
  61. *dayCurrent = (UCHAR) p_tm->tm_mday;
  62. }