当前位置:网站首页>C language to get program running time
C language to get program running time
2022-07-05 17:01:00 【Oh-liuxing】
#include <stdio.h>
#include <time.h>
int main(){
printf("hello word\n");
printf("Time used = %.2lf\n", (double)clock() / CLOCKS_PER_SEC);
return 0;
}
explain :(1) Timing function clock() Returns the time the program has run so far , In Milliseconds . Call it before the program ends , You can get the running time of the whole program . This time is divided by a constant CLOCKS_PER_SEC The resulting value is expressed in “ second ” In units of .
(2) stay VC++6.0 in time.h Constants defined by the next macro CLOCKS_PER_SEC, Its value is 1000.
#define CLOCKS_PER_SEC 1000
about CLOCKS_PER_SEC, It's used to show how many clock units there are in a second , The length of the clock timing unit is 1 millisecond ,clock()/CLOCKS_PER_SEC Is to convert milliseconds into seconds .
边栏推荐
- Allusions of King Xuan of Qi Dynasty
- How was the middle table destroyed?
- Is it safe to open a securities account by mobile phone? Detailed steps of how to buy stocks
- Apple has abandoned navigationview and used navigationstack and navigationsplitview to implement swiftui navigation
- Domestic API management artifact used by the company
- Hiengine: comparable to the local cloud native memory database engine
- Win11 prompt: what if the software cannot be downloaded safely? Win11 cannot download software safely
- [es6] 模板字符串内添加if判断或添加三元运算符判断
- Jarvis OJ Webshell分析
- Twig数组合并的写法
猜你喜欢

Bs-xx-042 implementation of personnel management system based on SSM

Jarvis OJ shell流量分析

解决CMakeList find_package找不到Qt5,找不到ECM

精准防疫有“利器”| 芯讯通助力数字哨兵护航复市

Flet tutorial 12 stack overlapping to build a basic introduction to graphic and text mixing (tutorial includes source code)

浏览器渲染原理以及重排与重绘

兰空图床苹果快捷指令

How to uninstall MySQL cleanly

国产芯片产业链两条路齐头并进,ASML真慌了而大举加大合作力度

二叉树相关OJ题
随机推荐
Twig数组合并的写法
国产芯片产业链两条路齐头并进,ASML真慌了而大举加大合作力度
Summary of methods for finding intersection of ordered linked list sets
composer安装报错:No composer.lock file present.
[brush title] goose factory shirt problem
C# TCP如何设置心跳数据包,才显得优雅呢?
项目引入jar从私服Nexus 拉去遇到的一个问题
【刷題篇】鹅廠文化衫問題
If you can't afford a real cat, you can use code to suck cats -unity particles to draw cats
【Web攻防】WAF检测技术图谱
齐宣王典故
How to set the WiFi password of the router on the computer
ECU introduction
[es6] add if judgment or ternary operator judgment in the template string
拷贝方式之DMA
精准防疫有“利器”| 芯讯通助力数字哨兵护航复市
[echart] resize lodash to realize chart adaptation when window is zoomed
Jarvis OJ Flag
C# TCP如何限制单个客户端的访问流量
二叉树相关OJ题