home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / ctime.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  1KB  |  46 lines

  1. /***
  2. *ctime.c - convert time argument into ASCII string
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       contains ctime() - convert time value to string
  8. *
  9. *******************************************************************************/
  10.  
  11. #include <cruntime.h>
  12. #include <time.h>
  13. #include <stddef.h>
  14. #include <tchar.h>
  15.  
  16. /***
  17. *_TSCHAR *ctime(time) - converts a time stored as a long to a ASCII string
  18. *
  19. *Purpose:
  20. *       Converts a time stored as a long (time_t) to an ASCII string of
  21. *       the form:
  22. *              Tue May 1 14:25:03 1984
  23. *
  24. *Entry:
  25. *       long *time - time value in XENIX format
  26. *
  27. *Exit:
  28. *       returns pointer to static string or NULL if time is before
  29. *       Jan 1 1980.
  30. *
  31. *Exceptions:
  32. *
  33. *******************************************************************************/
  34.  
  35. _TSCHAR * __cdecl _tctime (
  36.         const time_t *timp
  37.         )
  38. {
  39.         struct tm *tmtemp;
  40.  
  41.         if ((tmtemp=localtime(timp)) != NULL)
  42.                 return(_tasctime((const struct tm *)tmtemp));
  43.         else
  44.                 return(NULL);
  45. }
  46.