|
|
coherent
asctime() Time Function asctime()
Convert time structure to ASCII string
#include <time.h>
#iinncclluuddee <ssyyss/ttyyppeess.hh>
cchhaarr *aassccttiimmee(_t_m_p) ttmm *_t_m_p;
asctime takes the data found in tmp, and turns it into an ASCII
string. tmp is of the type tm, which is a structure defined in
the header file time.h. This structure must first be initialized
by either gmtime or localtime before it can be used by asctime.
For a further discussion of tm, see the entry for time.
asctime returns a pointer to where it writes the text string it
creates.
***** Example *****
The following example demonstrates the functions asctime, ctime,
gmtime, localtime, and time, and shows the effect of the environ-
mental variable TIMEZONE. For a discussion of the variable
time_t, see the entry for time.
#include <time.h>
#include <types.h>
main()
{
time_t timenumber;
tm *timestruct;
/* read system time, print using ctime */
time(&timenumber);
printf("%s", ctime(&timenumber));
/* use gmtime to fill tm, print with asctime */
timestruct = gmtime(&timenumber);
printf("%s", asctime(timestruct));
/* use localtime to fill tm, print with asctime */
timestruct = localtime(&timenumber);
printf("%s", asctime(timestruct));
}
***** See Also *****
time
COHERENT Lexicon Page 1
asctime() Time Function asctime()
***** Notes *****
asctime returns a pointer to a statically allocated data area
that is overwritten by successive calls.
COHERENT Lexicon Page 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.