1 //----------------------------------------------------------------------------- 2 // 3 // TimeStampImpl.h 4 // 5 // WinRT implementation of a TimeStamp 6 // 7 // Copyright (c) 2015 Microsoft Corporation 8 // All rights reserved. 9 // 10 // SOFTWARE NOTICE AND LICENSE 11 // 12 // This file is part of OpenZWave. 13 // 14 // OpenZWave is free software: you can redistribute it and/or modify 15 // it under the terms of the GNU Lesser General Public License as published 16 // by the Free Software Foundation, either version 3 of the License, 17 // or (at your option) any later version. 18 // 19 // OpenZWave is distributed in the hope that it will be useful, 20 // but WITHOUT ANY WARRANTY; without even the implied warranty of 21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 // GNU Lesser General Public License for more details. 23 // 24 // You should have received a copy of the GNU Lesser General Public License 25 // along with OpenZWave. If not, see <http://www.gnu.org/licenses/>. 26 // 27 //----------------------------------------------------------------------------- 28 #ifndef _TimeStampImpl_H 29 #define _TimeStampImpl_H 30 31 #include "Defs.h" 32 33 namespace OpenZWave 34 { 35 namespace Internal 36 { 37 namespace Platform 38 { 39 40 /** \brief Windows implementation of a timestamp. 41 */ 42 class TimeStampImpl 43 { 44 public: 45 /** 46 * Constructor. 47 * Creates a TimeStampImpl object. 48 */ 49 TimeStampImpl(); 50 51 /** 52 * Destructor. 53 * Destroys the TimeStampImpl object. 54 */ 55 ~TimeStampImpl(); 56 57 /** 58 * SetTime. Sets the timestamp to now, plus the offset in milliseconds. 59 * \param _milliseconds positive or negative offset from 60 * now in milliseconds. 61 */ 62 void SetTime(int32 _milliseconds); 63 64 /** 65 * TimeRemaining. Gets the difference between now and the timestamp 66 * time in milliseconds. 67 * \return milliseconds remaining until we reach the timestamp. The 68 * return value is negative if the timestamp is in the past. 69 */ 70 int32 TimeRemaining(); 71 72 /** 73 * Return as as string 74 */ 75 string GetAsString(); 76 77 /** 78 * Overload the subtract operator to get the difference between 79 * two timestamps in milliseconds. 80 */ 81 int32 operator-(TimeStampImpl const& _other); 82 83 private: 84 TimeStampImpl(TimeStampImpl const&); // prevent copy 85 TimeStampImpl& operator =(TimeStampImpl const&); // prevent assignment 86 87 int64 m_stamp; 88 }; 89 } // namespace Platform 90 } // namespace Internal 91 } // namespace OpenZWave 92 93 #endif //_TimeStampImpl_H 94 95