This repository has been archived on 2022-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
LEFTONE/core/locommon/ticker.h
falsycat 80b3b82332 [RELEASE] u22-v04
This version is submitted for U22 final presentation. (squashed 158 commits)
2021-02-07 00:00:00 +00:00

46 lines
685 B
C

#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <msgpack.h>
#define LOCOMMON_TICKER_UNIT 1000
typedef struct {
uint64_t time;
uint64_t prev_time;
int64_t delta;
float delta_f;
} locommon_ticker_t;
void
locommon_ticker_initialize(
locommon_ticker_t* ticker,
uint64_t time
);
void
locommon_ticker_deinitialize(
locommon_ticker_t* ticker
);
void
locommon_ticker_tick(
locommon_ticker_t* ticker,
uint64_t time
);
void
locommon_ticker_pack(
const locommon_ticker_t* ticker,
msgpack_packer* packer
);
bool
locommon_ticker_unpack(
locommon_ticker_t* ticker,
const msgpack_object* obj
);