Skip to content

Instantly share code, notes, and snippets.

@sailfish009
Created April 16, 2019 01:25
Show Gist options
  • Save sailfish009/bd993aec83a6e4165ec417caad6c2ea7 to your computer and use it in GitHub Desktop.
Save sailfish009/bd993aec83a6e4165ec417caad6c2ea7 to your computer and use it in GitHub Desktop.
https://stackoverflow.com/questions/290227/java-system-currenttimemillis-equivalent-in-c-sharp
private static readonly DateTime Jan1st1970 =
new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public static long currentTimeMillis()
{
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment