当前位置:网站首页>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 .
边栏推荐
- C# TCP如何设置心跳数据包,才显得优雅呢?
- [61dctf]fm
- Copy mode DMA
- 飞桨EasyDL实操范例:工业零件划痕自动识别
- Win11 prompt: what if the software cannot be downloaded safely? Win11 cannot download software safely
- Flet tutorial 12 stack overlapping to build a basic introduction to graphic and text mixing (tutorial includes source code)
- 【微信小程序】一文读懂小程序的生命周期和路由跳转
- dried food! Semi supervised pre training dialogue model space
- Wsl2.0 installation
- Can you help me see what the problem is? [ERROR] Could not execute SQL stateme
猜你喜欢
![[729. My schedule I]](/img/e3/32914227d00cf7595ee850e60f2b72.png)
[729. My schedule I]

The first EMQ in China joined Amazon cloud technology's "startup acceleration - global partner network program"

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

美国芯片傲不起来了,中国芯片成功在新兴领域夺得第一名

Hiengine: comparable to the local cloud native memory database engine

ECU简介

"21 days proficient in typescript-3" - install and build a typescript development environment md

DenseNet

SQL injection of cisp-pte (Application of secondary injection)

Jarvis OJ shell流量分析
随机推荐
挖财股票开户安全吗?怎么开股票账户是安全?
【Web攻防】WAF检测技术图谱
The difference between searching forward index and inverted index
Google Earth Engine(GEE)——Kernel核函数简单介绍以及灰度共生矩阵
【刷题篇】有效的数独
【729. 我的日程安排表 I】
Games101 notes (I)
Games101 notes (II)
Accès aux données - intégration du cadre d'entité
Application of threshold homomorphic encryption in privacy Computing: Interpretation
Jarvis OJ Webshell分析
Jarvis OJ simple network management protocol
【 brosser le titre 】 chemise culturelle de l'usine d'oies
Detailed explanation of use scenarios and functions of polar coordinate sector diagram
C# TCP如何设置心跳数据包,才显得优雅呢?
Jarvis OJ Telnet Protocol
Timestamp strtotime the day before or after the date
如何将mysql卸载干净
Games101 notes (III)
Wsl2.0 installation