windows:  Calculates the wall-clock time used by the calling process. return:The elapsed wall-clock time since the start of the process

Linux:The clock() function returns an approximation of processor time used by the program

Windows:

 #include <stdio.h>
#include <time.h>
#include <windows.h> int main()
{
printf("The start clock is: %ld\n", clock());
Sleep();
printf("The end clock is: %ld\n", clock()); return ;
}

Linux:

 #include <stdio.h>
#include <time.h>
#include <unistd.h> int main()
{
printf("The start clock is: %ld\n", clock());
sleep();
printf("The end clock is: %ld\n", clock()); return ;
}

 

运行的结果:

Windows:

The start clock is: 1

The end clock is: 2001

Linux:

The start clock is: 0

The end clock is: 0

参考:

http://blog.csdn.net/lxmky/article/details/7026986

http://msdn.microsoft.com/en-us/library/aa272059(v=vs.60).aspx

man clock

Windows和linux下clock函数的更多相关文章

  1. Windows和Linux下putenv()函数导致composer更新失败

    bug复现: 原因: putenv() 函数设置特定的环境变量有可能是一个潜在的安全漏洞,所以这个函数在php配置文件中是默认禁止的,在 php.ini 中查找此函数,然后将此函数删除掉,重载配置即可 ...

  2. 转:socket编程在windows和linux下的区别

    如无其它说明,本文所指Linux均表示2.6内核Linux,GCC编译器,Windows均表示Windows XP系统,Visual Studio 2005 sp1编译环境. 下面大概分几个方面进行罗 ...

  3. socket编程在windows和linux下的区别

    如无其它说明,本文所指Linux均表示2.6内核Linux,GCC编译器,Windows均表示Windows XP系统,Visual Studio 2005 sp1编译环境. 下面大概分几个方面进行罗 ...

  4. Windows与Linux下文件操作监控的实现

    一.需求分析: 随着渲染业务的不断进行,数据传输渐渐成为影响业务时间最大的因素.究其原因就是因为数据传输耗费较长的时间.于是,依托于渲染业务的网盘开发逐渐成为迫切需要解决的需求.该网盘的实现和当前市场 ...

  5. socket在windows下和linux下的区别

    原文:socket在windows下和linux下的区别 1)头文件 windows下winsock.h/winsock2.h linux下sys/socket.h    错误处理:errno.h 2 ...

  6. linux下sprintf_s函数的替代

    error code: ]; sprintf_s(buf, , "predicted position:(%3d, %3d)", predict_pt.x, predict_pt. ...

  7. Windows和Linux下通用的线程接口

    对于多线程开发,Linux下有pthread线程库,使用起来比较方便,而Windows没有,对于涉及到多线程的跨平台代码开发,会带来不便.这里参考网络上的一些文章,整理了在Windows和Linux下 ...

  8. linux select函数:Linux下select函数的使用详解【转】

    本文转载自;http://www.bkjia.com/article/28216.html Linux下select函数的使用 Linux下select函数的使用 一.Select 函数详细介绍 Se ...

  9. linux下syscall函数,SYS_gettid,SYS_tgkill

    出处:http://blog.chinaunix.net/uid-28458801-id-4630215.html     linux下syscall函数,SYS_gettid,SYS_tgkill  ...

随机推荐

  1. Algorithm(1) - Karatsuba multiplication

    这个系列主要是记一下目前效率较高或者比较出名的一些算法. Karatsuba multiplication: x=5678   then: a=56  b=67 y=1234           c= ...

  2. python3转变exe的方法

    python开发的代码可能在其他windows上并不能使用用,除非别人的环境中也有python. 下面是如何将python开发的东西转为exe格式 1.安装pyinstaller pip instal ...

  3. Implement Queue by Two Stacks & Implement Stack using Queues

    Implement Queue by Two Stacks Implement the following operations of a queue using stacks. push(x) -- ...

  4. 『实践』VirtualBox 5.1.18+Centos 6.8+hadoop 2.7.3搭建hadoop完全分布式集群及基于HDFS的网盘实现

    『实践』VirtualBox 5.1.18+Centos 6.8+hadoop 2.7.3搭建hadoop完全分布式集群及基于HDFS的网盘实现 1.基本设定和软件版本 主机名 ip 对应角色 mas ...

  5. SpringBoot 构建RestFul API 含单元测试

    相关博文: 从消费者角度评估RestFul的意义 SpringBoot 构建RestFul API 含单元测试 首先,回顾并详细说明一下在快速入门中使用的  @Controller .  @RestC ...

  6. 启动虚拟机报错VMware Workstation cannot connect to the virtual machine

    启动虚拟机报错: VMware Workstation cannot connect to the virtual machine. Make sure you have rights to run ...

  7. 三、vue脚手架工具vue-cli的使用

    1.vue-cli构建 vue-cli工具构建:https://blog.csdn.net/u013182762/article/details/53021374 npm的镜像替换成淘宝 2.项目运行 ...

  8. [How to]HBase集群备份方法

    1.简介 当HBase数据库中存在非常重要的业务数据的时候为了保护数据的可以对数据进行备份处理.对于HBase来说从备份操作来看可分为离线备份和在线备份. 2. 前准备 在测试环境上准备有哦两套HBa ...

  9. (转)js函数前加分号和感叹号是什么意思?有什么用?

    转载地址:https://www.cnblogs.com/mq0036/p/4605255.html 一般看JQuery插件里的写法是这样的 (function($) { //... })(jQuer ...

  10. vue项目里的日期格式化

    在项目中,我们经常需要把后台传回的日期进行格式化,可以在common里定义一个公共的js export function formatDate (date, fmt) { if (/(y+)/.tes ...