backport millisecond time precision from mongoid master

see pull request in mongoid official repo: https://github.com/mongoid/mongoid/pull/1673