Skip to content

Instantly share code, notes, and snippets.

@i3arnon
Created October 2, 2015 22:33
Show Gist options
  • Save i3arnon/955437b41d566170c135 to your computer and use it in GitHub Desktop.
Save i3arnon/955437b41d566170c135 to your computer and use it in GitHub Desktop.
Replacing EpochOrigin fixes the issue.
typeof (BclHelpers).
GetField("EpochOrigin", BindingFlags.NonPublic | BindingFlags.Static).
SetValue(null, new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
var dolly = new Sheep {DateOfBirth = new DateTime(1966, 07, 05, 11, 0, 0, DateTimeKind.Utc)};
Console.WriteLine(dolly.DateOfBirth.ToString("HH:mm:ss K")); // "11:00:00 Z" (Z means UTC)
dolly = Serializer.DeepClone(dolly); // Serialize and deserialize using protobuf-net
Console.WriteLine(dolly.DateOfBirth.ToString("HH:mm:ss K")); // "11:00:00 Z"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment