time.c 478 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2010-11-17 Bernard first version
  9. */
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <finsh.h>
  13. int speed()
  14. {
  15. int i;
  16. time_t t;
  17. printf("%d\n", time(0));
  18. for (i = 0; i < 10000000; ++i)
  19. t = time(0);
  20. printf("%d\n", time(0));
  21. return 0;
  22. }
  23. FINSH_FUNCTION_EXPORT(speed, speed test);