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. Java SSM框架之MyBatis3(六)MyBatis之参数传递

    一.单个参数  StudentParamsMapper package cn.cnki.ref.mapper; import cn.cnki.ref.pojo.Student; public inte ...

  2. 【IT界的厨子】家常版本的黄焖鸡

    前言: 周末在家,闲来无事, 使用简单的食材,满足家人的味蕾,做出秒杀馆子的黄焖鸡(我是这么认为的).虽然没有厨师的手艺,但为家人做饭,也是一种幸福. 用料: 主料:老母鸡一只,要求店老板剁好 配料: ...

  3. 第10月第20天 afnetwork like MKNetworkEngine http post

    1. + (AFHTTPRequestOperation *)requestSellerWithCompletion:(requestFinishedCompletionBlock)successBl ...

  4. 第10月第10天 git

    1. 已经用 git commit  提交了代码. 此命令可以用来回退到任意版本:git reset --hard  commitid https://www.cnblogs.com/qufanblo ...

  5. 第5月第13天 node cnpm安装 babel

    1. https://nodejs.org/en/download/ http://www.runoob.com/react/react-install.html 2. npm install --s ...

  6. 面试:----Struts和springmvc的区别--区别上

    SpringMVC和Struts2的区别 1核心控制器(前端控制器,预处理控制器):对于使用过MVC框架的人来说这个词应该不会陌生.核心控制器的主要用途处理所有的请求.然后对那些特殊的请求.统一的进行 ...

  7. docker之容器访问和网络连接(三)

    前言 当一台服务器上部署了多个应用容器,它们直接可能需要相互通信,比如web应用容器需要访问mysql数据库容器. 主机访问容器 通过映射端口的形式我们可以在外部访问容器内的服务 # 将主机的127. ...

  8. USB的挂起和唤醒(Suspend and Resume)【转】

    转自:http://m.blog.csdn.net/blog/luckywang1103/25244091 USB协议的第9章讲到USB可见设备状态[Universal Serial Bus Spec ...

  9. binlog2sql的安装及使用

    binlog2sql是大众点评开源的一款用于解析binlog的工具,在测试环境试用了下,还不错. DBA或开发人员,有时会误删或者误更新数据,如果是线上环境并且影响较大,就需要能快速回滚.传统恢复方法 ...

  10. django Rest Framework---缓存通过drf-extensions扩展来实现

    什么情况下使用缓存 1.不经常更新的数据 2.用户经常访问的一些页面,比如商品列表页.商品详情页等 3.用户经常修改的一些操作:购物车.订单中心等 关于DRF缓存扩展可以参考文档:http://chi ...