I would suggest this:
uint64_t nanosec(struct timeval t) { /* Calculate nanoseconds in a timeval structure */
return t.tv_sec * 1000000000 + t.tv_usec * 1000;
}
More Related Contents:
- Not able to calculate in C.How do you calculate in C?
- How to represent FLOAT number in memory in C
- How to dynamically allocate memory space for a string and get that string from user?
- How do I check if a variable is of a certain type (compare two types) in C?
- How to read string from keyboard using C?
- Checking if float is an integer
- How Does sizeof(Array) work
- Should I free char* initialized using string-literals?
- How do I print a non-null-terminated string using printf?
- C: correct usage of strtok_r
- What is the fastest way to convert float to int on x86
- Passing two-dimensional array via pointer
- Should you always use ‘int’ for numbers in C, even if they are non-negative?
- practical examples use dup or dup2
- strcmp() return values in C [duplicate]
- Linking with gcc and -lm doesn’t define ceil() on Ubuntu
- How to find the size of an array (from a pointer pointing to the first element array)?
- What is “…” in switch-case in C code
- How are static variables with the same name in different functions identified by the System?
- PTHREAD_MUTEX_INITIALIZER vs pthread_mutex_init ( &mutex, param)
- C initialize array within structure
- Releasing bound ports on process exit
- How does the compare function in qsort work?
- Why is execstack required to execute code on the heap?
- Assign string to element in structure in C
- Is typecast required in malloc? [duplicate]
- What is the difference between %f and %lf in C?
- Order of fields when using a bit field in C
- problems with char array = char array
- pthread execution on linux