Skip to content

Instantly share code, notes, and snippets.

@erichschroeter
erichschroeter / timer_unix.c
Last active November 9, 2018 10:11
Cross-platform timer example in C.
#include <stdio.h>
#include <time.h>
#define PRINT_INTERVAL 1000 /* in milliseconds */
#define MILLI 0
#define MICRO 1
#define NANO 2
#define RESOLUTION MILLI
long diff_nano(struct timespec *start, struct timespec *end)