Skip to content

Instantly share code, notes, and snippets.

@erichschroeter
erichschroeter / timer_unix.c
Last active March 9, 2025 01:26
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)