I am trying to convert this python instruction to C#
int(round(time.time()))
But I cannot figure out what it does exactly.
I am trying to convert this python instruction to C#
int(round(time.time()))
But I cannot figure out what it does exactly.
You need to use UtcNow as opposed to Now or else you will get an answer offset by your timezone.
TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
int timestamp = (int) t.TotalSeconds;