I'm trying to convert a tm struct to a string using strftime() in a Kinetis KL25Z using codewarrior ide.
When calling strftime i get an error saying "undefined reference to 'strftime'". Test code used below:
#include "derivative.h" /* include peripheral declarations */
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
struct tm dateinfo;
struct tm *dateinfoPointer=&dateinfo;
int main(void)
{
int counter = 0;
char buffer[8];
strftime(buffer,sizeof(buffer),"%H:%M:%S",dateinfoPointer);
for(;;) {
counter++;
}
return 0;
}
What I'm missing?
I would be surprised if this function is implemented for your Cortex M0 uC. Usually time.h
functions are not implemented or the functions are on;y the stubs. Programming such a small micros you need to forget your Windows/Linux programming habits.
So how to deal with time? Write it yourself :)