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.

59 lines
1.8 KiB

  1. /***
  2. *ctime.c - convert time argument into ASCII string
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * contains ctime() - convert time value to string
  8. *
  9. *Revision History:
  10. * 03-??-84 RLB initial version
  11. * 05-??-84 DFW split off into seperate module
  12. * 02-18-87 JCR put in NULL ptr support
  13. * 04-10-87 JCR changed long declaration ot time_t and added const.
  14. * 12-11-87 JCR Added "_LOAD_DS" to declaration
  15. * 03-20-90 GJF Replaced _LOAD_DS with _CALLTYPE1, added #include
  16. * <cruntime.h> and fixed the copyright. Also, cleaned
  17. * up the formatting a bit.
  18. * 05-21-90 GJF Fixed compiler warning.
  19. * 10-04-90 GJF New-style function declarators.
  20. * 04-06-93 SKS Replace _CRTAPI* with __cdecl
  21. * 11-01-93 CFW Enable Unicode variant, rip out Cruiser.
  22. * 08-30-99 PML Fix function header comment, detab.
  23. *
  24. *******************************************************************************/
  25. #include <cruntime.h>
  26. #include <time.h>
  27. #include <stddef.h>
  28. #include <tchar.h>
  29. /***
  30. *_TSCHAR *ctime(time) - converts a time stored as a long to a ASCII string
  31. *
  32. *Purpose:
  33. * Converts a time stored as a time_t to an ASCII string of the form:
  34. * Tue May 01 14:25:03 1984
  35. *
  36. *Entry:
  37. * time_t *time - time value in XENIX format
  38. *
  39. *Exit:
  40. * returns pointer to static string or NULL if time is before
  41. * Jan 1 1980.
  42. *
  43. *Exceptions:
  44. *
  45. *******************************************************************************/
  46. _TSCHAR * __cdecl _tctime (
  47. const time_t *timp
  48. )
  49. {
  50. struct tm *tmtemp;
  51. if ((tmtemp=localtime(timp)) != NULL)
  52. return(_tasctime((const struct tm *)tmtemp));
  53. else
  54. return(NULL);
  55. }