Guardian C Library Calls Reference Manual

asctime
3-4 128833Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
Examples
1. This example converts the calendar time pointed to by &now to local time in the
form of a string.
#include <timeh>
#include <stdioh>
time_t now;
int main(void)
{
now = time(NULL);
printf("%s%s\n",
"asctime(localtime(&now)) = ", asctime(localtime(&now)));
}
2. This example shows two alternate methods for converting the calendar time to local
time in the form of a string.
#include <timeh>
#include <stdioh>
time_t now;
int main(void)
{
now = time(NULL);
printf("\n%s%s\n%s%s\n",
" ctime(&now) = ", ctime(&now),
"asctime(localtime(&now)) = ", asctime(localtime(&now)));
}
Note that the following two function calls are equivalent:
asctime(localtime(&now)) and ctime(&now)