zoukankan      html  css  js  c++  java
  • 设置系统时钟

     private DispatcherTimer _timer;
    
    
       private void SetTimeElaspInStatusBar()
            {
                try
                {
                    
                    _timer = new DispatcherTimer();
                    _timer.Tick += (sender, e) =>
                    {
                        DateTime dtNow = DateTime.Now;
                        TimeSpan interval = dtNow - _enterSystemTime;
    
                        this.barElapsedTime.Content = null;
    
                        #region
    
                        TimeZoneInfo currentTimeZone = TimeZoneUtil.GetLocalTimeZone();
                        if (currentTimeZone != null)
                        {
                            string str = currentTimeZone.Id;
    
                            this.barElapsedTime.Content += "     Local Time(" + str + " )"
                                + ": "
                                + dtNow.ToString("MM/dd/yyyy HH:mm:ss");
    
                            //DateTimeUtil.ConvertToUniversalTimeString(this._enterSystemTime, "MM/dd/yyyy HH:mm:ss");
                        }
    
                        //this.barElapsedTime.Content += "     UTC Time : "
                        //    + DateTimeUtil.ConvertToUniversalTimeString(dtNow, "MM/dd/yyyy HH:mm:ss");
    
                        DateTime? dtUTC =TimeZoneUtil.ConvertTimeToUTC(dtNow);
                     
                        if (dtUTC != null)
                        {
                            this.barElapsedTime.Content += "     UTC Time : "
                                +((DateTime)dtUTC).ToString("MM/dd/yyyy HH:mm:ss");
                        }
    
    
                        ////Convert To "Central America Standard Time"
                        //DateTime? dtUSCenter = TimeZoneUtil.ConvertFromUTC((DateTime)dtUTC, "Central America Standard Time");
    
                        //if (dtUSCenter != null)
                        //{
    
                        //    this.barElapsedTime.Content += "     UTC Time to  Central America Standard Time: "
                        //                               + ((DateTime)dtUSCenter).ToString("MM/dd/yyyy HH:mm:ss");
                        //}
    
                        #endregion
    
                        this.barElapsedTime.Content += "        Elapsed Time: " + (interval.Days > 0 ? interval.Days + " day(s) " : "") +
                           new DateTime(1900, 1, 1, interval.Hours, interval.Minutes, interval.Seconds).ToString("HH:mm:ss");
    
                        //
                        if (EventBinder.SystemTimeOutCheck.IsCheckTimeOut)
                        {
                            EventBinder.SystemTimeOutCheck.Check();
                        }
                       // SystemThreadStarter.StartGetUrlThread();
                    };
                    _timer.Interval = TimeSpan.FromSeconds(1);
                    _timer.Start();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
  • 相关阅读:
    ABAP中的‘多线程’
    SAP数据库表维护视图分配事务代码
    SAP调用外部数据库
    ABAP-小技巧/知识(1)
    sap中用函数增加断点(break point)
    把内表 itab1 的 n1 到 n2 行内容附加到 itab2 内表中去.
    ABAP打开TCODE
    查看用户下有那些事务码
    check、continue、exit的区别
    将excel数据导入内表的函数
  • 原文地址:https://www.cnblogs.com/quietwalk/p/3531644.html
Copyright © 2011-2022 走看看