 +		if (!accel_state->timestamp)
 +			accel_state->timestamp = iio_get_time_ns();
 +
-+ 		hid_sensor_push_data(indio_dev,
++		hid_sensor_push_data(indio_dev,
 +				     accel_state->accel_val,
 +				     sizeof(accel_state->accel_val),
 +				     accel_state->timestamp);

+static void hid_sensor_push_data(struct iio_dev *indio_dev, void *data,
+				 int len, int64_t timestamp)
 {
	dev_dbg(&indio_dev->dev, "hid_sensor_push_data\n");
-	iio_push_to_buffers(indio_dev, data);
+	iio_push_to_buffers_with_timestamp(indio_dev, data, timestamp);
 }

 /* Callback handler to send event after all samples are received and captured */
@@ -208,10 +211,17 @@ static int gyro_3d_proc_event(struct hid_sensor_hub_device *hsdev,
	struct gyro_3d_state *gyro_state = iio_priv(indio_dev);

	dev_dbg(&indio_dev->dev, "gyro_3d_proc_event\n");
-	if (atomic_read(&gyro_state->common_attributes.data_ready))
+	if (atomic_read(&gyro_state->common_attributes.data_ready)) {
+		if (!gyro_state->timestamp)
+			gyro_state->timestamp = iio_get_time_ns();
+
		hid_sensor_push_data(indio_dev,
-				gyro_state->gyro_val,
-				sizeof(gyro_state->gyro_val));
+				     gyro_state->gyro_val,

+		gyro_state->timestamp = 0;
+	}

 	return 0;
 }
@@ -236,6 +246,10 @@ static int gyro_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
 						*(u32 *)raw_data;
 		ret = 0;
 	break;
+	case HID_USAGE_SENSOR_TIME_TIMESTAMP:
+		gyro_state->timestamp = *(int64_t *)raw_data;
+		ret = 0;
+	break;
 	default:
 		break;
 	}
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index f2ee90a..9a3a9db 100644
--- a/include/linux/hid-sensor-ids.h
