C# Unity获取当前时间的时间戳

    private long GetTime()
    {
    
    
    //精确到毫秒
       return  new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds();
       
    }

在调用接口时 需要传入当前的时间戳,在网上找的大部分都是13年14年的文章,里面的方法现在都用不了了,突然想起来,之前写过,就把之前的那个工程代码扒拉出来了,

猜你喜欢

转载自blog.csdn.net/o_ojjj/article/details/120286837