-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTime.cpp
More file actions
41 lines (33 loc) · 746 Bytes
/
Time.cpp
File metadata and controls
41 lines (33 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* =====================================================================================
*
* Filename: Time.cpp
*
* Description:
*
* Version: 1.0
* Created: 2018-01-15 15:37:25
* Last Modified: 2018-01-15 15:37:36
* Revision: none
* Compiler: gcc
*
* Author: zt (),
* Organization:
*
* =====================================================================================
*/
#include <stdio.h>
#include <time.h>
#include <unistd.h>
int main ( int argc, char* argv[] )
{
( void ) argc;
( void ) argv;
time_t ti, t2;
time ( &ti );
sleep ( 3 );
time ( &t2 );
printf ( "%f\n", difftime ( t2, ti ) );
printf ( "%f\n", difftime ( ti, t2 ) );
return 0;
}