mlib update: new isnan()/isnanf() implementation
[tangerine.git] / compiler / clib / asctime.c
blob2ff2e266e3422bee4dd4597a559f3b3971f83883
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 Convert a time into a string.
6 */
8 /*****************************************************************************
10 NAME */
11 #include <time.h>
13 char * asctime (
15 /* SYNOPSIS */
16 const struct tm * tm)
18 /* FUNCTION
19 The asctime() function converts the broken-down time value tm
20 into a string with this format:
22 "Wed Jun 30 21:49:08 1993\n"
24 The return value points to a statically allocated string which
25 might be overwritten by subsequent calls to any of the date and
26 time functions.
28 INPUTS
29 tm - The broken down time
31 RESULT
32 A statically allocated buffer with the converted time. Note that
33 there is a newline at the end of the buffer and that the contents
34 of the buffer might get lost with the call of any of the date
35 and time functions.
37 NOTES
39 EXAMPLE
40 time_t tt;
41 struct tm * tm;
42 char * str;
44 // Get time
45 time (&tt);
47 // Break time up
48 tm = localtime (&tt);
50 // Convert to string
51 str = asctime (tm);
53 BUGS
55 SEE ALSO
56 time(), ctime(), localtime()
58 INTERNALS
60 ******************************************************************************/
62 static char buffer[26];
64 strftime (buffer, sizeof (buffer), "%C\n", tm);
66 return buffer;
67 } /* asctime */