1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2024-12-25 17:19:46 +05:30
gists/c-programming/benchmarking/clock_hr_microsec.h

44 lines
877 B
C

/*
* clock_hr_microsec.h
*
* Author: Intel A80486DX2-66
* License: Unlicense
*/
#ifndef _CLOCK_HR_MICROSEC_H
#define _CLOCK_HR_MICROSEC_H
#include <stdio.h>
// typedefs
typedef long double clock_hr_microsec_t;
// print specifiers
#define CLOCK_HR_MICROSEC_PRI ".3Lf"
// system identification
#ifdef _WIN32
# define SYS_NT
# include <windows.h>
#endif
#if defined(__unix__) || defined(__APPLE__)
# define SYS_UNIX
#endif
// macros
#if defined(SYS_UNIX) && !defined(CLOCK_MONOTONIC_RAW)
# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
#endif
// function prototypes
void clock_hr_microsec_init(void);
clock_hr_microsec_t clock_hr_microsec(void);
clock_hr_microsec_t clock_hr_microsec_diff(clock_hr_microsec_t a,
clock_hr_microsec_t b);
#ifdef SYS_NT
void WinAPI_perror(const char* s);
#endif
#endif /* _CLOCK_HR_MICROSEC_H */