C Codes
Beginners
C on Unix
Code Snippets
Data Structures
File Operations
Games Graphics
Gnu-Linux
Hardware
Mathematics
Miscellaneous
Small Programs
Sorting
C > Miscellaneous sample source codes
Time c code 2
Time c code 2 #include <stdio.h> #include <stdlib.h> #include <unistd.h> /* sleep() */ #include <time.h> int main(void) { time_t start, end; start = time(NULL); if(start == (time_t)-1) { fprintf(stderr, "Error: `time()'\n"); return 1; } printf("sleepingggzzzzzzz....5sec's\n"); sleep(5); end = time(NULL); printf("according to difftime(), slept for %.2f sec's\n", difftime(end, start)); return 0; }
Privacy Policy
|
Link to Us
|
Links