p7-5.c

来自「SUN Solaris8平台下进程间通信」· C语言 代码 · 共 18 行

C
18
字号
#include <time.h>#include <stdio.h>#include <unistd.h>int main(void){    int i;    time_t the_time, begin_time;    begin_time = time((time_t *)0);    for(i=1;i<=10;i++){        the_time = time((time_t *)0);        printf("The time is %ld\n",the_time);        sleep(2);    }    the_time = time((time_t *)0);    printf("elapsed wall time is %lf(s)\n", difftime(the_time, begin_time));    exit(0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?