Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / time / asctime.c
bloba81506181502bb3cfed27e39df5fb6c7d95b3f24
1 /*
2 * asctime.c
3 * Original Author: G. Haley
5 * Converts the broken down time in the structure pointed to by tim_p into a
6 * string of the form
8 * Wed Jun 15 11:38:07 1988\n\0
10 * Returns a pointer to the string.
14 FUNCTION
15 <<asctime>>---format time as string
17 INDEX
18 asctime
19 INDEX
20 _asctime_r
22 SYNOPSIS
23 #include <time.h>
24 char *asctime(const struct tm *<[clock]>);
25 char *_asctime_r(const struct tm *<[clock]>, char *<[buf]>);
27 DESCRIPTION
28 Format the time value at <[clock]> into a string of the form
29 . Wed Jun 15 11:38:07 1988\n\0
30 The string is generated in a static buffer; each call to <<asctime>>
31 overwrites the string generated by previous calls.
33 RETURNS
34 A pointer to the string containing a formatted timestamp.
36 PORTABILITY
37 ANSI C requires <<asctime>>.
39 <<asctime>> requires no supporting OS subroutines.
42 #include <stdlib.h>
43 #include <string.h>
44 #include <time.h>
45 #include <_ansi.h>
46 #include <reent.h>
48 #ifdef _REENT_THREAD_LOCAL
49 _Thread_local char _tls_asctime_buf[_REENT_ASCTIME_SIZE];
50 #endif
52 #ifndef _REENT_ONLY
54 char *
55 asctime (const struct tm *tim_p)
57 struct _reent *reent = _REENT;
59 _REENT_CHECK_ASCTIME_BUF(reent);
60 return asctime_r (tim_p, _REENT_ASCTIME_BUF(reent));
63 #endif