generate error when platform is not supported

This commit is contained in:
Paolo Marrone 2024-07-09 12:20:57 +02:00
parent 5ef05ef959
commit 619ff345a3

View File

@ -10,7 +10,7 @@ unsigned long long fatica_time_process(void);
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
#include <windows.h> # include <windows.h>
static ULONGLONG filetime_to_ull(const FILETIME* ft) { static ULONGLONG filetime_to_ull(const FILETIME* ft) {
return (((ULONGLONG)ft->dwHighDateTime) << 32) + ft->dwLowDateTime; return (((ULONGLONG)ft->dwHighDateTime) << 32) + ft->dwLowDateTime;
@ -28,13 +28,13 @@ unsigned long long fatica_time_process(void) {
#elif defined(__linux__) #elif defined(__linux__)
#if __STDC_VERSION__ >= 199901L # if __STDC_VERSION__ >= 199901L
# define _XOPEN_SOURCE 600 # define _XOPEN_SOURCE 600
#else # else
# define _XOPEN_SOURCE 500 # define _XOPEN_SOURCE 500
#endif # endif
#include <time.h> # include <time.h>
#include <unistd.h> # include <unistd.h>
unsigned long long fatica_time_process(void) { unsigned long long fatica_time_process(void) {
struct timespec ts; struct timespec ts;
@ -45,9 +45,9 @@ unsigned long long fatica_time_process(void) {
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include <unistd.h> # include <unistd.h>
#include <mach/mach.h> # include <mach/mach.h>
#include <mach/thread_act.h> # include <mach/thread_act.h>
unsigned long long fatica_time_process(void) { unsigned long long fatica_time_process(void) {
thread_t thread = mach_thread_self(); thread_t thread = mach_thread_self();
@ -59,5 +59,7 @@ unsigned long long fatica_time_process(void) {
+ (info.user_time.microseconds + info.system_time.microseconds) / 1000; + (info.user_time.microseconds + info.system_time.microseconds) / 1000;
} }
#else
# error "System not supported"
#endif #endif
#endif // FATICA_H #endif // FATICA_H