time functions in codewarrior 7.1

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

time functions in codewarrior 7.1

2,080 次查看
pvk
Contributor I
I am using codewarrior 7.1 and and coldfire 5208 processor.I am trying to use time functions like mktime and gmtime in my application project but htey dont work.I tried most of the things freescale told me do like building new library and adding the new library in my project and all that.
It also says we have to provide our own implementation of the time functions as per the manual in "configuring time and Clock". But I do not know where to add these functions. I added it in time.c and  built it but it still gives linker error saying mktime() gmtime() undefined. Can anyone help me on this?
 
PVK
标签 (1)
标记 (1)
0 项奖励
回复
1 回复

652 次查看
stanish
NXP Employee
NXP Employee

Hello pvk,

I assume you didn't rebuild the MSL library that supports time functions correctly since the error "mktime() gmtime() undefined" occurs.
In fact these functions are implemented in time.c and in order to use it you should set macros _MSL_OS_TIME_SUPPORT, _MSL_CLOCK_T_AVAILABLE, _MSL_TIME_T_AVAILABLE to "1" in "ansi_prefix.CF.h" and rebuild the MSL library you are using. (I'd suggest you to backup the original libs before rebuild)

Anyway there are some specific time.c related functions that needs to be implemented. The function prototypes are located in the file "time_API.h".

I would not recommend you to add the implementations into "time.c" since this file is not suited for adding the custom code.
You can add implementation of these function wherever you want but you have to always add  #include <time.c>.

Stanish

0 项奖励
回复