コード例 #1
0
        /// <summary>
        /// 构建历元数据
        /// </summary>
        /// <param name="AtomicClock"></param>
        /// <returns></returns>
        private static string BuildClkRecord(AtomicClock AtomicClock)
        {
            StringBuilder sb            = new StringBuilder();
            var           OneBlankSpace = " ";
            string        clockType     = null;

            if (AtomicClock.ClockType == ClockType.Satellite)
            {
                clockType = "AS";
            }
            else
            {
                clockType = "AR";
            }
            sb.Append(clockType + OneBlankSpace);
            sb.Append(AtomicClock.Name + OneBlankSpace + OneBlankSpace);
            var epoch     = AtomicClock.Time;
            var firstLine = epoch.Year  //四位数的年
                            + OneBlankSpace + epoch.Month.ToString("00")
                            + OneBlankSpace + epoch.Day.ToString("00")
                            + OneBlankSpace + epoch.Hour.ToString("00")
                            + OneBlankSpace + epoch.Minute.ToString("00")
                            + OneBlankSpace + epoch.Second.ToString("00.000000")//F11.7
            ;

            sb.Append(firstLine);
            sb.Append(StringUtil.FillSpaceLeft(AtomicClock.StateCode, 3));
            sb.Append(OneBlankSpace);
            sb.Append(OneBlankSpace);
            sb.Append(DoubleUtil.ScientificFomate(AtomicClock.ClockBias, "E20.13", false));
            //sb.Append(OneBlankSpace);
            sb.Append(DoubleUtil.ScientificFomate(AtomicClock.ClockDrift, "E20.13", false));
            sb.AppendLine();
            return(sb.ToString());
        }
コード例 #2
0
 public void Write(AtomicClock record)
 {
     StringBuilder.Append(BuildClkRecord(record));
 }