/// <summary>
        /// Function to retrieve the timeGetTime time data.
        /// </summary>
        private void GetWin32Time()
        {
            if (!_initialized)
            {
                Reset();
            }

            long currentTime = WinMultimediaApi.timeGetTime();
            long ticks       = Environment.TickCount;

            // Handle wrap around every ~50 days.
            if (currentTime < _startTime)
            {
                long diff = uint.MaxValue - _startTime;
                _startTime   = diff;
                currentTime += diff;
            }

            if (ticks < _startTick)
            {
                long diff = uint.MaxValue - _startTick;
                _startTick = diff;
                ticks     += diff;
            }

            unchecked
            {
                _milliseconds = (currentTime - _startTime);
                _currentTicks = ticks - _startTick;
            }
        }
        /// <summary>
        /// Function to reset the timer.
        /// </summary>
        /// <exception cref="Win32Exception">Thrown when timer information cannot be retrieved from the operating system.</exception>
        public void Reset()
        {
            if (WinMultimediaApi.timeGetDevCaps(ref _timeCaps, Unsafe.SizeOf <TIMECAPS>()) != 0)
            {
                throw new Win32Exception(Resources.GOR_ERR_TIME_CANNOT_BEGIN);
            }

            if (_lastPeriod != null)
            {
                int period = _lastPeriod.Value;
                EndTiming();
                BeginTiming(period);
            }

            _startTick   = Environment.TickCount;
            _startTime   = WinMultimediaApi.timeGetTime();
            _initialized = true;
        }