Guest User

Untitled

a guest
Nov 15th, 2017
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.95 KB | None | 0 0
  1. /*----------------------------------------------------------------------------*/
  2. /* */
  3. /* StatTimer.h: interface for the CStatTimer class. */
  4. /* */
  5. /* Author: Mark Carrier ([email protected]) */
  6. /* */
  7. /*----------------------------------------------------------------------------*/
  8. /* Copyright (c) 2006 CarrierLabs, LLC. All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. *
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions and the following disclaimer.
  16. *
  17. * 2. Redistributions in binary form must reproduce the above copyright
  18. * notice, this list of conditions and the following disclaimer in
  19. * the documentation and/or other materials provided with the
  20. * distribution.
  21. *
  22. * 3. The name of the author may not be used to endorse or promote products
  23. * derived from this software without specific prior written permission.
  24. *
  25. * 4. The name "CarrierLabs" must not be used to
  26. * endorse or promote products derived from this software without
  27. * prior written permission. For written permission, please contact
  28. *
  29. * THIS SOFTWARE IS PROVIDED BY MARK CARRIER ``AS IS'' AND ANY
  30. * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  31. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  32. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MARK CARRIER OR
  33. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  35. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  36. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  39. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  40. * OF THE POSSIBILITY OF SUCH DAMAGE.
  41. *----------------------------------------------------------------------------*/
  42. #ifndef __CSTATTIMER_H__
  43. #define __CSTATTIMER_H__
  44.  
  45. #include <string.h>
  46.  
  47. #if defined(WIN32) || defined(_WIN32)
  48. #include <Winsock2.h>
  49. #include <time.h>
  50. #endif
  51.  
  52. #if defined(_LINUX) || defined(__MACH__) || defined(MACH)
  53. #include <stdio.h>
  54. #include <sys/time.h>
  55. #endif
  56.  
  57. #include "Host.h"
  58.  
  59. #if defined(WIN32) || defined(_WIN32)
  60. #define GET_CLOCK_COUNT(x) QueryPerformanceCounter((LARGE_INTEGER *)x)
  61. #else
  62. #define GET_CLOCK_COUNT(x) gettimeofday(x, NULL)
  63. #endif
  64.  
  65. #define MILLISECONDS_CONVERSION 1000
  66. #define MICROSECONDS_CONVERSION 1000000
  67.  
  68. #if __cplusplus >= 201103L
  69. #include <cstdint>
  70. #define int8 int8_t
  71. #define int16 int16_t
  72. #define int32 int32_t
  73. #define uint8 uint8_t
  74. #define uint16 uint16_t
  75. #define uint32 uint32_t
  76. #endif
  77.  
  78. /// Class to abstract socket communications in a cross platform manner.
  79. /// This class is designed
  80. class CStatTimer {
  81. public:
  82. CStatTimer()
  83. {
  84. };
  85.  
  86. ~CStatTimer()
  87. {
  88. };
  89.  
  90. void Initialize()
  91. {
  92. //memset(&m_startTime, 0, sizeof(struct timeval));
  93. //memset(&m_endTime, 0, sizeof(struct timeval));
  94. };
  95.  
  96. struct timeval GetStartTime() {timeval tmp; return tmp; };
  97. void SetStartTime() { /*GET_CLOCK_COUNT(&m_startTime); */};
  98.  
  99. struct timeval GetEndTime() {timeval tmp; return tmp; };
  100. void SetEndTime() { /*GET_CLOCK_COUNT(&m_endTime); */};
  101.  
  102. uint32 GetMilliSeconds() { return 0;};
  103. uint32 GetMicroSeconds() { return 0;};
  104. uint32 GetSeconds() { return 0;};
  105.  
  106. uint32 GetCurrentTime()
  107. {
  108. return 0;
  109. };
  110.  
  111. };
  112.  
  113. #endif // __CSTATTIMER_H__
Advertisement
Add Comment
Please, Sign In to add comment