How protobuf-net serialize DateTime?
c#, protobuf-net, protocol-buffers, python
Solution
DateTime is spoofed via a multi-field message that is not trivial, but not impossible to understand. In hindsight, I wish I had done it a different way, but it is what it is. The definition is available in bcl.proto in the protobuf-net project.
However! If you are targering multiple platforms, I strongly recommend you simply use a `long` etc in your DTO model, representing some time granularity into some epoch (seconds or milliseconds since 1970, for example).
Problem
I'm working on a project consisting on Client/Server. Client is written in Python (will run on linux) and server in C#. I'm communicating through standard sockets and I'm using protobuf-net for protocol definition. However, I'm wondering how would protobuf-net handle DateTime serialization. Unix datetime differs from .net standard datetime, so how should I handle this situation? Thanks