SW006014 Microchip Technology, SW006014 Datasheet - Page 146

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 142
mktime
Description:
Include:
Prototype:
Argument:
Return Value:
Remarks:
Example:
strftime
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Converts local time to a calendar value.
<time.h>
time_t mktime(struct tm *tptr);
tptr
Returns the calendar time encoded as a value of time_t.
If the calendar time cannot be represented, the function returns -1, cast
as a time_t (i.e. (time_t) -1).
#include <time.h>
#include <stdio.h> /* for printf
int main(void)
{
}
Output:
Local time = Mon Oct 20 16:43:02 2003
Calendar time as time_t = 1066668182
Formats the time structure to a string based on the format parameter.
<time.h>
size_t strftime(char *s, size_t n,
s
n
format
tptr
Returns the number of characters placed in the array s if the total
including the terminating null is not greater than n. Otherwise, the func-
tion returns 0 and the contents of array s are indeterminate.
The format parameters follow:
%a abbreviated weekday name
%A full weekday name
%b abbreviated month name
%B full month name
%c appropriate date and time representation
%d day of the month (01-31)
%H hour of the day (00-23)
const char *format, const struct tm *tptr);
time_t timer, whattime;
struct tm *newtime;
timer = 1066668182; /* Mon Oct 20 16:43:02 2003 */
/* localtime allocates space for struct tm */
newtime = localtime(&timer);
printf("Local time = %s", asctime(newtime));
whattime = mktime(newtime);
printf("Calendar time as time_t = %ld\n",
whattime);
a pointer to the time structure
output string
maximum length of string
format-control string
pointer to tm data structure
/* for localtime,
/* asctime, mktime, */
/* time_t, tm
© 2008 Microchip Technology Inc.
*/
*/
*/

Related parts for SW006014