1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 #include "device/vr/windows_mixed_reality/wrappers/wmr_timestamp.h" 5 6 #include <windows.perception.h> 7 #include <wrl.h> 8 9 #include "base/logging.h" 10 11 using ABI::Windows::Foundation::DateTime; 12 using ABI::Windows::Foundation::TimeSpan; 13 using ABI::Windows::Perception::IPerceptionTimestamp; 14 using Microsoft::WRL::ComPtr; 15 16 namespace device { 17 WMRTimestampImpl(ComPtr<IPerceptionTimestamp> timestamp)18WMRTimestampImpl::WMRTimestampImpl(ComPtr<IPerceptionTimestamp> timestamp) 19 : timestamp_(timestamp) { 20 DCHECK(timestamp_); 21 } 22 23 WMRTimestampImpl::~WMRTimestampImpl() = default; 24 TargetTime() const25DateTime WMRTimestampImpl::TargetTime() const { 26 DateTime val; 27 HRESULT hr = timestamp_->get_TargetTime(&val); 28 DCHECK(SUCCEEDED(hr)); 29 return val; 30 } 31 PredictionAmount() const32TimeSpan WMRTimestampImpl::PredictionAmount() const { 33 TimeSpan val; 34 HRESULT hr = timestamp_->get_PredictionAmount(&val); 35 DCHECK(SUCCEEDED(hr)); 36 return val; 37 } 38 GetRawPtr() const39IPerceptionTimestamp* WMRTimestampImpl::GetRawPtr() const { 40 return timestamp_.Get(); 41 } 42 } // namespace device 43