SW006014 Microchip Technology, SW006014 Datasheet - Page 144

C COMPILER MPLAB FOR PIC24 MCU

SW006014

Manufacturer Part Number
SW006014
Description
C COMPILER MPLAB FOR PIC24 MCU
Manufacturer
Microchip Technology
Type
MPLAB® C Compilerr
Series
PIC24r
Datasheet

Specifications of SW006014

Supported Families
PIC24
Core Architecture
PIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24
Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC24
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
DS51456E-page 140
difftime
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Example:
gmtime
Description:
Include:
Prototype:
Argument:
Return Value:
Remarks:
Find the difference between two times.
<time.h>
double difftime(time_t t1, time_t t0);
t1
t0
Returns the number of seconds between t1 and t0.
By default, the 16-bit compiler returns the time as instruction cycles so
difftime returns the number of ticks between t1 and t0.
#include <time.h>
#include <stdio.h> /* for printf
volatile int i;
int main(void)
{
}
Output:
start = 0
stop = 317
Elapsed time = 317
Converts calendar time to time structure expressed as Universal Time
Coordinated (UTC) also known as Greenwich Mean Time (GMT).
<time.h>
struct tm *gmtime(const time_t *tod);
tod
Returns the address of the time structure.
This function breaks down the tod value into the time structure of type
tm. By default, the 16-bit compiler returns the time as instruction
cycles. With this default gmtime and localtime will be equivalent
except gmtime will return tm_isdst (Daylight Savings Time flag) as
zero to indicate that Daylight Savings Time is not in effect.
clock_t start, stop;
double elapsed;
start = clock();
for (i = 0; i < 10; i++)
stop = clock();
printf("start = %ld\n", start);
printf("stop = %ld\n", stop);
elapsed = difftime(stop, start);
printf("Elapsed time = %.0f\n", elapsed);
ending time
beginning time
pointer to stored time
/* for clock, difftime */
© 2008 Microchip Technology Inc.
*/

Related parts for SW006014