SQL Server has a datetime datatype that looks like it stores millisecond precision but the actual internal precision is 1/300 s, which may cause rounding to the previous/next milllisecond on storage.
Since SQL Server 2008, a datetime2 datatype is available that can store full milliseconds (https://msdn.microsoft.com/en-us/library/bb677335.aspx).
Use this feature.
In addition to the added precision, this allows us to simplify some special cases in a number of unit tests.