Reputation: 8951
Consider the following simple piece of code:
TimeSpan ts = (DateTime.UtcNow - new DateTime(1970, 1, 1));
UInt64 microTimestamp = (Convert.ToUInt64(ts.TotalSeconds))*1000000;
Console.WriteLine ("Now: " + DateTime.UtcNow.ToString());
Console.WriteLine ("Microtimestamp: " + microTimestamp);
I have compiled it to an exe and execute it on two machines:
Device 1: MacBook
Now: 12.12.2013 16:26:57
Microtimestamp: 1386865617000000
Device 2: Raspberry Pi
Now: 735214/00/0001 16:25:14
Microtimestamp: 0
Both devices have their date and time correctly set up (which I checked in the OS's control panels). Why the heck does the Raspberry not produce a correct result?
Upvotes: 4
Views: 783
Reputation: 86779
My psychic debugging powers tell me that you are using "hard float" Raspbian (as opposed to "soft float". Rasphian distributes the "hard float" build by default (as its faster), however there is currently a bug in Mono on "hard float" distros caused by issues with the calling conventions for floating point numbers.
Your options are either:
See also
Upvotes: 5