

asctime()                 Time Function                 asctime()




Convert time structure to ASCII string

#include <time.h>
#iinncclluuddee <ssyyss/ttyyppeess.hh>
cchhaarr *aassccttiimmee(_t_m_p) ttmm *_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


