File indexing completed on 2025-01-18 09:39:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef BOOST_LOG_DETAIL_TIMESTAMP_HPP_INCLUDED_
0017 #define BOOST_LOG_DETAIL_TIMESTAMP_HPP_INCLUDED_
0018
0019 #include <boost/cstdint.hpp>
0020 #include <boost/log/detail/config.hpp>
0021 #if defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
0022 #include <boost/winapi/basic_types.hpp>
0023 #endif
0024 #include <boost/log/detail/header.hpp>
0025
0026 #ifdef BOOST_HAS_PRAGMA_ONCE
0027 #pragma once
0028 #endif
0029
0030 namespace boost {
0031
0032 BOOST_LOG_OPEN_NAMESPACE
0033
0034 namespace aux {
0035
0036
0037
0038
0039 class duration
0040 {
0041 int64_t m_ticks;
0042
0043 public:
0044 explicit duration(int64_t ticks = 0) BOOST_NOEXCEPT : m_ticks(ticks) {}
0045
0046 #if defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
0047 int64_t milliseconds() const { return m_ticks; }
0048 #else
0049 BOOST_LOG_API int64_t milliseconds() const;
0050 #endif
0051 };
0052
0053
0054
0055
0056 class timestamp
0057 {
0058 uint64_t m_ticks;
0059
0060 public:
0061 explicit timestamp(uint64_t ticks = 0) BOOST_NOEXCEPT : m_ticks(ticks) {}
0062
0063 duration operator- (timestamp that) const
0064 {
0065 return duration(m_ticks - that.m_ticks);
0066 }
0067 };
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077 #if defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
0078
0079 typedef uint64_t (BOOST_WINAPI_WINAPI_CC* get_tick_count_t)();
0080 extern BOOST_LOG_API get_tick_count_t get_tick_count;
0081
0082 inline timestamp get_timestamp()
0083 {
0084 return timestamp(get_tick_count());
0085 }
0086
0087 #else
0088
0089 typedef timestamp (*get_timestamp_t)();
0090 extern BOOST_LOG_API get_timestamp_t get_timestamp;
0091
0092 #endif
0093
0094 }
0095
0096 BOOST_LOG_CLOSE_NAMESPACE
0097
0098 }
0099
0100 #include <boost/log/detail/footer.hpp>
0101
0102 #endif