Windows NT 4.0 source code leak
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.

56 lines
1.4 KiB

4 years ago
  1. /***
  2. *ctime.c - convert time argument into ASCII string
  3. *
  4. * Copyright (c) 1985-1991, 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. *
  21. *******************************************************************************/
  22. #include <cruntime.h>
  23. #include <time.h>
  24. #include <stddef.h>
  25. /***
  26. *char *ctime(time) - converts a time stored as a long to a ASCII string
  27. *
  28. *Purpose:
  29. * Converts a time stored as a long (time_t) to an ASCII string of
  30. * the form:
  31. * Tue May 1 14:25:03 1984
  32. *
  33. *Entry:
  34. * long *time - time value in XENIX format
  35. *
  36. *Exit:
  37. * returns pointer to static string or NULL if time is before
  38. * Jan 1 1980.
  39. *
  40. *Exceptions:
  41. *
  42. *******************************************************************************/
  43. char * _CALLTYPE1 ctime (
  44. const time_t *timp
  45. )
  46. {
  47. struct tm *tmtemp;
  48. if ((tmtemp=localtime(timp)) != NULL)
  49. return(asctime((const struct tm *)tmtemp));
  50. else
  51. return(NULL);
  52. }