Don't write timestamps

This commit is contained in:
htrefil 2020-10-25 18:00:01 +01:00
parent e06cb40dd7
commit 46a20132b0

View file

@ -1,6 +1,6 @@
use crate::async_file::{AsyncFile, OpenMode}; use crate::async_file::{AsyncFile, OpenMode};
use crate::event::Event; use crate::event::Event;
use crate::setup::{self, input_event}; use crate::setup::{self, input_event, timeval};
use std::io::Error; use std::io::Error;
use std::mem; use std::mem;
use std::os::unix::io::AsRawFd; use std::os::unix::io::AsRawFd;
@ -24,7 +24,12 @@ impl EventWriter {
self.write_raw(event.to_raw()).await self.write_raw(event.to_raw()).await
} }
pub(crate) async fn write_raw(&mut self, event: input_event) -> Result<(), Error> { pub(crate) async fn write_raw(&mut self, mut event: input_event) -> Result<(), Error> {
event.time = timeval {
tv_sec: 0,
tv_usec: 0,
};
let data: [u8; mem::size_of::<input_event>()] = unsafe { mem::transmute(event) }; let data: [u8; mem::size_of::<input_event>()] = unsafe { mem::transmute(event) };
self.file.write_all(&data).await self.file.write_all(&data).await
} }