asctime, asctime_r

Converts the time information into a string.

Library:LibC
Classification:ANSI
Service:Time

Syntax

  #include <time.h> 
   
  char *asctime (
     const struct tm   *localtime);
  
  char *asctime_r (
    const struct tm   *localtime,   
    char              *timestr);
  

Parameters

localtime

(IN) Points to the structure containing the time information to convert.

timestr

(OUT) Points to a buffer for the converted string.

Return Values

Returns a pointer to the character string result.

Remarks

The asctime and asctime_r functions convert the time information in the structure pointed to by localtime into a string containing exactly 26 characters.

This string has the form shown in the following example:

     Wed Mar 21 15:58:27 2002\n\0
  

All fields have a constant width. The newline character \n and the null character (\0) occupy the last two positions of the string. The area containing the returned string is reused each time asctime is called.

The asctime_r function provides the same functionality as asctime, but asctime_r is designed for use with a reentrant NLMâ„¢. The asctime_r function allows the caller to pass storage for the results rather than relying on per-thread data.

See Also