I would like to use next code:
long long DateTimeToTimeT(System::DateTime dt)
{
System::DateTime epoch(1970, 1, 1, 0, 0, 0, 0);
long long totalSeconds = (dt - epoch).TotalSeconds;
return totalSeconds >= 0 ? totalSeconds : 0;
}
So question is: Is it exception safe or I should handle some errors here?
I mean: Is is safe to convert from double
(which is TotalSeconds) to long long
in such case?