This will give you the time in seconds + microseconds
#include <sys/time.h>
struct timeval tv;
gettimeofday(&tv,NULL);
tv.tv_sec // seconds
tv.tv_usec // microseconds
More Related Contents:
- HOW I CALCULATE TIME IN C PROGRAM
- Measure time in Linux – time vs clock vs getrusage vs clock_gettime vs gettimeofday vs timespec_get?
- clock_gettime alternative in Mac OS X
- Get a timestamp in C in microseconds?
- Get the current time in C [duplicate]
- how to convert datetime to unix timestamp in c?
- Calculating elapsed time in a C program in milliseconds
- implement time delay in c
- How to print time difference in accuracy of milliseconds and nanoseconds from C in Linux?
- Get current time in milliseconds using C++ and Boost
- How to print time in format: 2009‐08‐10 18:17:54.811
- How do I measure time in C?
- What is time(NULL) in C?
- How to convert from UTC to local time in C?
- error: incompatible types for a function that returns float in C
- Are there differences between pointers to object stored on stack and heap? [closed]
- Why scanf() reads two values when we put spaces after format specifier even we are passing one reference
- Is char signed or unsigned by default?
- C undefined behavior. Strict aliasing rule, or incorrect alignment? [duplicate]
- How to send a simple string between two programs using pipes?
- How to calculate the CPU usage of a process by PID in Linux from C?
- Where you can and cannot declare new variables in C?
- Dynamic programming – Largest square block
- Using M_PI with C89 standard
- C Strings Comparison with Equal Sign
- Simple C implementation to track memory malloc/free?
- read file backwards (last line first)
- Merging two sorted linked lists
- Why can’t a modifiable lvalue have an array type?
- functions returning char pointer