I see this conversion a lot when trying to convert this to a legitimate time:

SELECT DATEADD (ms, -1 * ((s.cpu_ticks) - r.[timestamp]), GETDATE())
FROM sys.dm_os_ring_buffers r
                CROSS JOIN sys.dm_os_sys_info s

I get the error:

Arithmetic overflow error converting expression to data type int.

What's the correct formula for converting this?


  • note that when using cross join with sys.dm_os_sysinfo, each ms_ticks value applied to the timestamp will have a different value. Using @Tara Kizer answer below will address the issue so timestamps can be ordered correctly after conversion – Trubs Oct 24 '19 at 3:51

See the SQL Server 2008 calculation in this article. It applies to 2012, 2014 and 2016 too.

cpu_ticks is what was used in SQL Server 2005.

declare @ts_now bigint 

select @ts_now = ms_ticks from 


select record_id, dateadd (ms, (y.[timestamp] -@ts_now), GetDate())

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.