home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / compiler / clib / asctime.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-29  |  1.4 KB  |  72 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: asctime.c,v 1.1 1997/01/29 16:51:34 digulla Exp $
  4.  
  5.     Desc: Convert a time into a string.
  6.     Lang: english
  7. */
  8.  
  9. /*****************************************************************************
  10.  
  11.     NAME */
  12. #include <time.h>
  13.  
  14.     char * asctime (
  15.  
  16. /*  SYNOPSIS */
  17.     const struct tm * tm)
  18.  
  19. /*  FUNCTION
  20.     The asctime() function converts the broken-down time value tm
  21.     into a string with this format:
  22.  
  23.         "Wed Jun 30 21:49:08 1993\n"
  24.  
  25.     The return value points to a statically allocated string which
  26.     might be overwritten by subsequent calls to any of the date and
  27.     time functions.
  28.  
  29.     INPUTS
  30.     tm - The broken down time
  31.  
  32.     RESULT
  33.     A statically allocated buffer with the converted time. Note that
  34.     there is a newline at the end of the buffer and that the contents
  35.     of the buffer might get lost with the call of any of the date
  36.     and time functions.
  37.  
  38.     NOTES
  39.  
  40.     EXAMPLE
  41.     time_t        tt;
  42.     struct tm * tm;
  43.     char      * str;
  44.  
  45.     // Get time
  46.     time (&tt);
  47.  
  48.     // Break time up
  49.     tm = localtime (&tt);
  50.  
  51.     // Convert to string
  52.     str = asctime (tm);
  53.  
  54.     BUGS
  55.  
  56.     SEE ALSO
  57.     time(), ctime(), localtime()
  58.  
  59.     INTERNALS
  60.  
  61.     HISTORY
  62.     29.01.1997 digulla created
  63.  
  64. ******************************************************************************/
  65. {
  66.     static char buffer[26];
  67.  
  68.     strftime (buffer, sizeof (buffer), "%C\n", tm);
  69.  
  70.     return buffer;
  71. } /* asctime */
  72.