Compiling Error when including "time.h", MQX4.1, gcc

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

Compiling Error when including "time.h", MQX4.1, gcc

588 次查看
weapon
Senior Contributor I

Hi Folks,

I created a MQX project based on TWR-K60D100 GCC, and included "time.h" in. but there were some compiling errors . could you give me some hints about that. below is the screenshot.

pastedImage_0.png

0 项奖励
2 回复数

289 次查看
DavidS
NXP Employee
NXP Employee

Hi Weiping,

I have some example code attached in zip to show how to setup the MQX time manually or to use an automated process that gets the time from a NTP (network time protocol) server or if that fails then to use the MQX RTOS compiled time/date to at least get a course time/date setting.

I had created a shell command "sh_oneshot.c" that goes in the following path:

C:\Freescale\Freescale_MQX_4_X\shell\source\rtcs

Hope this help you or others.

Regards,

David

0 项奖励

289 次查看
danielchen
NXP TechSupport
NXP TechSupport

Unfortunately the time functions are not implemented  - This header file (time.h) is provided for compatibility only, the implementation is fully hardware dependent.

"The ANSI library provides several functions to get the current time. In an embedded systems environment, implementations for these functions cannot be provided because different targets may use different ways to count the time."

If you need it, you have to write your own functions (if you have some Real Time Clock component on your board).

0 项奖励