Subversion Repositories Kolibri OS

Rev

Rev 4874 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.  * asctime.c
  3.  * Original Author:     G. Haley
  4.  *
  5.  * Converts the broken down time in the structure pointed to by tim_p into a
  6.  * string of the form
  7.  *
  8.  * Wed Jun 15 11:38:07 1988\n\0
  9.  *
  10.  * Returns a pointer to the string.
  11.  */
  12.  
  13. /*
  14. FUNCTION
  15. <<asctime>>---format time as string
  16.  
  17. INDEX
  18.         asctime
  19. INDEX
  20.         _asctime_r
  21.  
  22. ANSI_SYNOPSIS
  23.         #include <time.h>
  24.         char *asctime(const struct tm *<[clock]>);
  25.         char *_asctime_r(const struct tm *<[clock]>, char *<[buf]>);
  26.  
  27. TRAD_SYNOPSIS
  28.         #include <time.h>
  29.         char *asctime(<[clock]>)
  30.         struct tm *<[clock]>;
  31.         char *asctime_r(<[clock]>)
  32.         struct tm *<[clock]>;
  33.         char *<[buf]>;
  34.  
  35. DESCRIPTION
  36. Format the time value at <[clock]> into a string of the form
  37. . Wed Jun 15 11:38:07 1988\n\0
  38. The string is generated in a static buffer; each call to <<asctime>>
  39. overwrites the string generated by previous calls.
  40.  
  41. RETURNS
  42. A pointer to the string containing a formatted timestamp.
  43.  
  44. PORTABILITY
  45. ANSI C requires <<asctime>>.
  46.  
  47. <<asctime>> requires no supporting OS subroutines.
  48. */
  49.  
  50. #include <time.h>
  51. #include <_ansi.h>
  52. #include <reent.h>
  53.  
  54. #ifndef _REENT_ONLY
  55.  
  56. char *
  57. _DEFUN (asctime, (tim_p),
  58.         _CONST struct tm *tim_p)
  59. {
  60.   struct _reent *reent = _REENT;
  61.  
  62.   _REENT_CHECK_ASCTIME_BUF(reent);
  63.   return asctime_r (tim_p, _REENT_ASCTIME_BUF(reent));
  64. }
  65.  
  66. #endif
  67.