MCPcopy Create free account
hub / github.com/aws/clock-bound / duration

Function duration

examples/client/c/src/clockbound_now.c:81–91  ·  view source on GitHub ↗

* Helper function to calculate a time interval between two timestamps held in a struct timespec. */

Source from the content-addressed store, hash-verified

79 * Helper function to calculate a time interval between two timestamps held in a struct timespec.
80 */
81double duration(struct timespec start, struct timespec end) {
82 int secs = end.tv_sec - start.tv_sec;
83 int nsecs = (int) end.tv_nsec - (int) start.tv_nsec;
84
85 if (nsecs < 0) {
86 nsecs += 1000000000;
87 secs--;
88 }
89
90 return (double) secs + (double) nsecs / 1000000000;
91}
92
93int main(int argc, char *argv[]) {
94 clockbound_ctx *ctx;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected