2021-07-04 22:50:19 +08:00
|
|
|
#ifndef SC_TICK_H
|
|
|
|
#define SC_TICK_H
|
|
|
|
|
2021-11-07 02:26:29 +08:00
|
|
|
#include "common.h"
|
|
|
|
|
2021-07-04 22:50:19 +08:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef int64_t sc_tick;
|
2021-07-14 04:32:05 +08:00
|
|
|
#define PRItick PRIi64
|
2021-07-04 22:50:19 +08:00
|
|
|
#define SC_TICK_FREQ 1000000 // microsecond
|
|
|
|
|
|
|
|
// To be adapted if SC_TICK_FREQ changes
|
2021-12-07 06:33:59 +08:00
|
|
|
#define SC_TICK_TO_NS(tick) ((tick) * 1000)
|
2021-07-04 22:50:19 +08:00
|
|
|
#define SC_TICK_TO_US(tick) (tick)
|
|
|
|
#define SC_TICK_TO_MS(tick) ((tick) / 1000)
|
|
|
|
#define SC_TICK_TO_SEC(tick) ((tick) / 1000000)
|
2021-12-07 06:33:59 +08:00
|
|
|
#define SC_TICK_FROM_NS(ns) ((ns) / 1000)
|
2021-07-04 22:50:19 +08:00
|
|
|
#define SC_TICK_FROM_US(us) (us)
|
|
|
|
#define SC_TICK_FROM_MS(ms) ((ms) * 1000)
|
|
|
|
#define SC_TICK_FROM_SEC(sec) ((sec) * 1000000)
|
|
|
|
|
|
|
|
sc_tick
|
|
|
|
sc_tick_now(void);
|
|
|
|
|
|
|
|
#endif
|