mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-23 06:59:47 -05:00
Move get_time() helper to core
We'll need a better strategy for generating timestamps without input events or pageflips. At least we'll need to ensure everybody is using the same underlying time source.
This commit is contained in:
parent
c551bd2ae8
commit
ab8475cafd
3 changed files with 23 additions and 15 deletions
|
|
@ -32,6 +32,7 @@
|
|||
#include <sys/un.h>
|
||||
#include <dlfcn.h>
|
||||
#include <assert.h>
|
||||
#include <sys/time.h>
|
||||
#include <ffi.h>
|
||||
|
||||
#include "wayland-server.h"
|
||||
|
|
@ -484,6 +485,16 @@ wl_display_destroy(struct wl_display *display)
|
|||
free(display);
|
||||
}
|
||||
|
||||
WL_EXPORT uint32_t
|
||||
wl_display_get_time(struct wl_display *display)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_display_add_object(struct wl_display *display, struct wl_object *object)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -177,6 +177,9 @@ wl_display_set_compositor(struct wl_display *display,
|
|||
struct wl_compositor *compositor,
|
||||
const struct wl_compositor_interface *implementation);
|
||||
|
||||
uint32_t
|
||||
wl_display_get_time(struct wl_display *display);
|
||||
|
||||
void
|
||||
wl_display_post_frame(struct wl_display *display, uint32_t msecs);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue