rt-thread-official/examples/libc/time.c

28 lines
478 B
C
Raw Normal View History

2013-01-08 21:05:02 +08:00
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
2013-01-08 21:05:02 +08:00
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2010-11-17 Bernard first version
2013-01-08 21:05:02 +08:00
*/
#include <stdio.h>
#include <stdlib.h>
#include <finsh.h>
int speed()
{
2021-03-07 08:34:04 +08:00
int i;
time_t t;
2013-01-08 21:05:02 +08:00
2021-03-07 08:34:04 +08:00
printf("%d\n", time(0));
for (i = 0; i < 10000000; ++i)
t = time(0);
2013-01-08 21:05:02 +08:00
2021-03-07 08:34:04 +08:00
printf("%d\n", time(0));
return 0;
2013-01-08 21:05:02 +08:00
}
FINSH_FUNCTION_EXPORT(speed, speed test);