private BeijingTime() { this._client = new NTPClient(HOST); syncThread = new Thread(new ThreadStart(SyncTime)); syncThread.IsBackground = true; syncThread.Start(); }
public bool SetTime(System.DateTime trts) { NTPClient.SYSTEMTIME sYSTEMTIME; sYSTEMTIME.year = (short)trts.Year; sYSTEMTIME.month = (short)trts.Month; sYSTEMTIME.dayOfWeek = (short)trts.DayOfWeek; sYSTEMTIME.day = (short)trts.Day; sYSTEMTIME.hour = (short)trts.Hour; sYSTEMTIME.minute = (short)trts.Minute; sYSTEMTIME.second = (short)trts.Second; sYSTEMTIME.milliseconds = (short)trts.Millisecond; return(NTPClient.SetLocalTime(ref sYSTEMTIME)); }
private static extern bool SetLocalTime(ref NTPClient.SYSTEMTIME time);
private BeijingTime() { this._client = new NTPClient("ntp.sjtu.edu.cn"); }