MTK获取系统时间函数大全是本文要介绍的内容,主要是来了解并学习MTK中系统时间的获取,具体关于MTK中如何来获取系统时间的内容来看本文详解。
1、定义一个保存当前系统时间的结构体:typedefstruct{
- U8hour;
- U8min;
- U8sec;
- U8month;
- U8day;
- U8local;
- U16year;
- }Btl_Log_Time;
- MYTIMEinit_time;
调用获取当前系统时间的函数:
- GetDateTime(&init_time);
- curr_time.year=init_time.nYear;
- curr_time.month=init_time.nMonth;
- curr_time.day=init_time.nDay;
- curr_time.hour=init_time.nHour;
- curr_time.min=init_time.nMin;
- curr_time.sec=init_time.nSec;
2、相关系统时间函数
- kal_timeridkal_create_timer(kal_char*timer_name_ptr);
- voidkal_set_timer(kal_timeridtimer_id,kal_timer_func_ptrhandler_func_ptr,void*handler_param_ptr,/
- kal_uint32delay,kal_uint32reschedule_time);
- voidkal_cancel_timer(kal_timeridtimer_id);
- voidkal_get_time(kal_uint32*ticks_ptr);
- kal_uint32kal_get_time_remaining(kal_timeridtimer_id);
- kal_uint32kal_secs_to_ticks(kal_uint32secs);
- kal_uint32kal_milli_secs_to_ticks(kal_uint32milli_secs);
- kal_uint32kal_ticks_to_secs(kal_uint32ticks);
- kal_uint32kal_ticks_to_milli_secs(kal_uint32ticks);
- kal_uint32kal_check_allowed_sleep_clock(kal_uint32period_ticks);
计算执行系统时间代码
- {
- kal_uint32tick_beg,tick_end;
- kal_uint32ms_beg,ms_end;
- kal_get_time(&tick_beg);
- ms_beg=kal_ticks_to_milli_secs(tick_beg);
- //测试代码;
- kal_get_time(&tick_end);
- ms_end=kal_ticks_to_milli_secs(tick_end);
- kal_prompt_trace(0,"ticks:%d",ms_end-ms_beg);
- }
小结:解析MTK获取系统时间函数大全的内容介绍完了,希望通过MTK总系统时间的获取内容的学习能对你有所帮助