你可以使用一个TImer监控本地时间,被修改的话计算一下时间差就知道了。
你可以那网络时间与本地时间相减得到时间差,以后都按本地时间算差值。

解决方案 »

  1.   

    关于“如何计算本地时间差错”,你应该看看ntps简单协议。他其实就好像是“二元二次方程组”一样简单,稍微懂点脑子就会了。你可以访问一次服务器,获取本地时钟跟服务器的偏差。然后如果你想在服务器的某个时间处理,那么预先将这个时间换算为本地(偏差了的)时间就行了。
      

  2.   

    定时取得网络时间,记录偏差。多长时间取得一次网络时间,找到平衡点即可如果时间是非常critical的话,全部使用网络时间也没有关系,流量应该不大。
      

  3.   

    如果有服务器的话,可以访问服务器时间啊.
    尤其服务器上有数据库的话,通过SQL语句查询数据库时间是很简单的工作,而且也不产生对外流量
      

  4.   

    使用Sleep方法延迟时间
    #region Windows 窗体设计器生成的代码        /// <summary>
            /// 设计器支持所需的方法 - 不要
            /// 使用代码编辑器修改此方法的内容。
            /// </summary>
            private void InitializeComponent()
            {
                this.groupBox1 = new System.Windows.Forms.GroupBox();
                this.txt_Time = new System.Windows.Forms.TextBox();
                this.groupBox1.SuspendLayout();
                this.SuspendLayout();
                // 
                // groupBox1
                // 
                this.groupBox1.Controls.Add(this.txt_Time);
                this.groupBox1.Location = new System.Drawing.Point(6, 8);
                this.groupBox1.Name = "groupBox1";
                this.groupBox1.Size = new System.Drawing.Size(373, 74);
                this.groupBox1.TabIndex = 0;
                this.groupBox1.TabStop = false;
                this.groupBox1.Text = "每秒种获取一次系统时间并显示";
                // 
                // txt_Time
                // 
                this.txt_Time.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                this.txt_Time.ForeColor = System.Drawing.Color.Maroon;
                this.txt_Time.Location = new System.Drawing.Point(6, 20);
                this.txt_Time.Name = "txt_Time";
                this.txt_Time.Size = new System.Drawing.Size(360, 44);
                this.txt_Time.TabIndex = 0;
                // 
                // Frm_Main
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(384, 85);
                this.Controls.Add(this.groupBox1);
                this.Name = "Frm_Main";
                this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                this.Text = "使用Sleep方法延迟时间";
                this.Load += new System.EventHandler(this.Frm_Main_Load);
                this.groupBox1.ResumeLayout(false);
                this.groupBox1.PerformLayout();
                this.ResumeLayout(false);        }