Backport setting time_precision for JSON::Encoding

Backports 2 commits:
* 4cfc467594da86090efa63f1852fb82df9458c2b
* c0965004486f2ea5a9656ba718a3377c9614f97d
Merge pull request #50 from square/json-datewittime-subseconds

Backport setting time_precision for JSON::Encoding