8

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

Davita
  • 8,928
  • 14
  • 67
  • 119

1 Answers1

11

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).

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • @marc-gravell I need to parse proto message sent by a .Net encoded program in Python. How do I parse the datetime encoded by .Net? What is the encoding. I can't found blc.proto. – efficks Feb 05 '16 at 19:25
  • @efficks did you by any chance ask a github question of the same? I answered there, including a link to the schema – Marc Gravell Feb 06 '16 at 17:54