unity-获取网络时间

腾讯的NTP时间Ip:[http://cgi.im.qq.com/cgi-bin/cgi_svrtime]

NTP时间服务器–百科

using System;
using UnityEngine;
using System.Collections;

public class IntTime : MonoBehaviour
{
    private string timeURL = "http://cgi.im.qq.com/cgi-bin/cgi_svrtime";
    IEnumerator Start()
    {
        WWW www = new WWW(timeURL);
        yield return www;
        DateTime date = Convert.ToDateTime(www.text);
    }
}
    原文作者:passiony
    原文地址: https://www.jianshu.com/p/b9c5c954ab0d
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞