Microchip Technology SW006021-1N Benutzerhandbuch
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 348
2012 Microchip Technology Inc.
Example
#include <time.h>
#include <stdio.h>
void
main (void)
{
struct tm birthday;
birthday.tm_year = 83; // the 5th of May 1983
birthday.tm_mon = 5;
birthday.tm_mday = 5;
birthday.tm_hour = birthday.tm_min = birthday.tm_sec = 0;
printf("you were born approximately %ld seconds after the unix
epoch\n",
mktime(&birthday));
}
See Also
ctime()
, asctime()
Return Value
The time contained in the
tm
structure represented as the number of seconds since the
1970 Epoch, or -1 if this time cannot be represented.
MODF
Synopsis
#include <math.h>
double modf (double value, double * iptr)
Description
The
modf()
function splits the argument
value
into integral and fractional parts, each
having the same sign as
value
. For example, -3.17 would be split into the integral part
(-3) and the fractional part (-0.17).
The integral part is stored as a double in the object pointed to by
iptr
.
Example
#include <math.h>
#include <stdio.h>
void
main (void)
{
double i_val, f_val;
f_val = modf( -3.17, &i_val);
}
Return Value
The signed fractional part of
value
.