Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 用户手册
产品代码
SW006021-1
Library Functions
2012 Microchip Technology Inc.
DS52053B-page 319
ASCTIME
Synopsis
#include <time.h>
char * asctime (struct tm * t)
Description
The asctime() function takes the time broken down into the
struct tm
structure,
pointed to by its argument, and returns a 26 character string describing the current date
and time in the format:
and time in the format:
Sun Sep 16 01:03:52 1973\n\0
Note the newline at the end of the string. The width of each field in the string is fixed.
The example gets the current time, converts it to a
The example gets the current time, converts it to a
struct
tm
with localtime(), it
then converts this to ASCII and prints it. The time() function will need to be provided
by the user (see time() for details).
by the user (see time() for details).
Example
#include <stdio.h>
#include <time.h>
void
main (void)
{
time_t clock;
struct tm * tp;
time(&clock);
tp = localtime(&clock);
printf(“%s”, asctime(tp));
}
See Also
ctime()
, gmtime(), localtime(), time()
Return Value
A pointer to the string.
Note
The example will require the user to provide the time() routine as it cannot be
supplied with the compiler. See time() for more details.
supplied with the compiler. See time() for more details.
ASIN
Synopsis
#include <math.h>
double asin (double f)
Description
The
asin()
function implements the converse of sin(); i.e., it is passed a value in the
range -1 to +1, and returns an angle in radians whose sine is equal to that value.