ServiceStack/ServiceStack.Text — pull request #395 by schmidt4brains (2014-01-21 19:43:54+00:00)
Title: Serialize fractional seconds correctly

Fixed edge case where times between 0 and 1 milliseconds were not being serialized with any fractional seconds component.

This was causing some OrmLite.SQLite comparison operators (which are string based) to fail.

The problem was the `if (timeOfDay.Milliseconds == 0)` predicate used to detect if was OK to only serialize down to the seconds resolution, but not milliseconds.

That predicate isn't quite strong enough, since it omitted the fractional seconds when between 0 and 1 milliseconds (there are 10,000 ticks per millisecond).

Some of our SQlite-based unit tests were failing intermittently because there was a 1-in-1000 chance the serialization/deserialization was not symmetric.

Same bug exists in the v3.x branch.