delorie.com/djgpp/doc/libc/libc_45.html | search |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <time.h> char *asctime(const struct tm *tptr); |
This function returns an ASCII representation of the time represented by tptr. The string returned is always 26 characters and has this format:
Sun Jan 01 12:34:56 1993\n\0 |
The string pointed to is in a static buffer and will be overwritten with each call to asctime. The data should be copied if it needs to be preserved.
The layout of the struct tm
structure is like this:
struct tm { int tm_sec; /* seconds after the minute [0-60] */ int tm_min; /* minutes after the hour [0-59] */ int tm_hour; /* hours since midnight [0-23] */ int tm_mday; /* day of the month [1-31] */ int tm_mon; /* months since January [0-11] */ int tm_year; /* years since 1900 */ int tm_wday; /* days since Sunday [0-6] */ int tm_yday; /* days since January 1 [0-365] */ int tm_isdst; /* Daylight Savings Time flag */ long tm_gmtoff; /* offset from GMT in seconds */ char * tm_zone; /* timezone abbreviation */ }; |
A pointer to the string.
ANSI/ISO C | C89; C99 |
POSIX | 1003.2-1992; 1003.1-2001 |
time_t now; time(&now); printf("The current time is %s", asctime(localtime(&now))); |
webmaster | delorie software privacy |
Copyright © 2004 | Updated Apr 2004 |