feat: Calculate animation curve by time points rather than passed frames
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
@@ -80,3 +81,15 @@ int regex_match(const char *pattern, const char *str) {
|
||||
void wl_list_append(struct wl_list *list, struct wl_list *object) {
|
||||
wl_list_insert(list->prev, object);
|
||||
}
|
||||
|
||||
unsigned int get_now_in_ms(void) {
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
return timespec_to_ms(&now);
|
||||
}
|
||||
|
||||
unsigned int timespec_to_ms(struct timespec *ts) {
|
||||
return (unsigned int)ts->tv_sec * 1000 +
|
||||
(unsigned int)ts->tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user