The timestamp_us member of the sensor events has been renamed sensor_timestamp and now represents nanoseconds.

This commit is contained in:
Sam Lantinga 2022-12-04 08:31:19 -08:00
parent 73f4aeee6a
commit b8760a3ffe
26 changed files with 134 additions and 128 deletions

View file

@ -2960,7 +2960,7 @@ int SDL_PrivateJoystickTouchpad(Uint64 timestamp, SDL_Joystick *joystick, int to
return posted;
}
int SDL_PrivateJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_SensorType type, Uint64 timestamp_us, const float *data, int num_values)
int SDL_PrivateJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_SensorType type, Uint64 sensor_timestamp, const float *data, int num_values)
{
int i;
int posted = 0;
@ -2981,7 +2981,7 @@ int SDL_PrivateJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_Sens
/* Update internal sensor state */
SDL_memcpy(sensor->data, data, num_values * sizeof(*data));
sensor->timestamp_us = timestamp_us;
sensor->sensor_timestamp = sensor_timestamp;
/* Post the event, if desired */
#if !SDL_EVENTS_DISABLED
@ -2994,7 +2994,7 @@ int SDL_PrivateJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_Sens
num_values = SDL_min(num_values, SDL_arraysize(event.csensor.data));
SDL_memset(event.csensor.data, 0, sizeof(event.csensor.data));
SDL_memcpy(event.csensor.data, data, num_values * sizeof(*data));
event.csensor.timestamp_us = timestamp_us;
event.csensor.sensor_timestamp = sensor_timestamp;
posted = SDL_PushEvent(&event) == 1;
}
#endif /* !SDL_EVENTS_DISABLED */