📄 testosclockget.c
字号:
#include <reworks/clock.h>
#include <reworks/tasks.h>
#include <ucore/error.h>
#include <stdio.h>
int testOSClockGet()
{
OS_STATUS status;
os_tod new_time;
os_tod current_time;
printf("*** test of OSClockGet ***\n");
printf("get the current time\n");
status = OSClockGet (OS_TOD_GET,¤t_time);
if (status != OS_OK)
{
printf("OSClockGet error:[%s]\n",serrno(errno));
return -1;
}
else
printf("the current time is %d.%d.%d,%d:%d:%d:%d\n",
current_time.year,
current_time.month,
current_time.day,
current_time.hour,
current_time.minute,
current_time.second,
current_time.ticks);
printf("task delay 100 ticks\n");
OSTaskDelay(100);
status = OSClockGet (OS_TOD_GET,¤t_time);
printf("get the time again\n");
if (status != OS_OK)
{
printf("OSClockGet error:[%s]\n",serrno(errno));
return -1;
}
else
printf("now the time is %d.%d.%d,%d:%d:%d:%d\n",
current_time.year,
current_time.month,
current_time.day,
current_time.hour,
current_time.minute,
current_time.second,
current_time.ticks);
printf("*** OSClockGet test OK! ***\n");
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -