/**********************************************************************
 *
 *  timer.h
 *
 *  Header of timer.c
 *
 *  v 0.0.0 2024.11.22 by Winson Chen
 *
 *    create
 *
 **********************************************************************/

#ifndef _TIMER_H
#define _TIMER_H

#define _GNU_SOURCE	//for nanosleep	20241128

#include <linux/version.h>
#include <stddef.h>
#include <time.h>	//for nanosleep	20241128

#if LINUX_VERSION_CODE == KERNEL_VERSION(2,2,6)
#include <time.h>
#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,12)
#include <sys/time.h>
#else
#include <time.h>
#endif

typedef unsigned long long int __tod_t;

extern __tod_t _time_get_tod();
extern void _time_set_deadline(unsigned long usec, struct timeval *deadline);
extern int _time_out(struct timeval *deadline);
extern void delay_us(unsigned int microseconds);
// extern int _set_timeout(long usec, __sighandler_t h_sigalrm);

#endif	/* _TIMER_H */
