コード例 #1
0
ファイル: Form1.cs プロジェクト: YangRiverJiang/DateTrans
 private void on_modify_mjd(object sender, EventArgs e)
 {
     if (editing)
     {
         return;
     }
     editing = true;
     try
     {
         mjd = new MJDTime(
             int.Parse(textBox8.Text),
             double.Parse(textBox11.Text)
             );
         cur  = new utc(mjd);
         gpst = new GPSTime(mjd);
         lc   = cur.offset_hour(time_differ);
         get_doy();
         update();
         label6.Text = "";
     }
     catch (Exception exce)
     {
         label6.Text = "猪";
     }
     editing = false;
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: YangRiverJiang/DateTrans
        private void on_modify_utc(object sender, EventArgs e)
        {
            if (editing)
            {
                return;
            }
            editing = true;
            try
            {
                cur = new utc(
                    int.Parse(textBox1.Text),
                    int.Parse(textBox2.Text),
                    int.Parse(textBox3.Text),
                    int.Parse(textBox5.Text),
                    int.Parse(textBox7.Text),
                    int.Parse(textBox10.Text)
                    );
                lc = cur.offset_hour(time_differ);

                mjd  = new MJDTime(cur);
                gpst = new GPSTime(cur);
                get_doy();
                update();
                label6.Text = "";
            }
            catch (Exception exce)
            {
                label6.Text = "猪";
            }
            editing = false;
        }
コード例 #3
0
        public GPSTime(MJDTime time)
        {
            week = (int)((time.days - 44244) / 7);
            int remain = time.days - week * 7 - 44244;

            sec = (int)((remain + time.frac_day) * 86400.0);
        }
コード例 #4
0
        public GPSTime(utc time)
        {
            MJDTime m_time = new MJDTime(time);

            week = (int)((m_time.days - 44244) / 7.0);
            int remain = m_time.days - week * 7 - 44244;

            sec = (int)((remain + m_time.frac_day) * 86400.0);
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: YangRiverJiang/DateTrans
 public Form1()
 {
     InitializeComponent();
     editing = true;
     System.DateTime lcn         = System.DateTime.Now;
     System.DateTime currentTime = System.DateTime.UtcNow;
     time_differ = (int)(lcn - currentTime).TotalHours;
     lc          = new utc(lcn.Year - (lcn.Year / 100) * 100, lcn.Month, lcn.Day, lcn.Hour, lcn.Minute, lcn.Second);
     cur         = new utc(currentTime.Year - (currentTime.Year / 100) * 100, currentTime.Month, currentTime.Day, currentTime.Hour, currentTime.Minute, currentTime.Second);
     mjd         = new MJDTime(cur);
     gpst        = new GPSTime(cur);
     get_doy();
     update();
     editing = false;
 }
コード例 #6
0
        public utc(MJDTime time)
        {
            double rest = time.frac_day * 24;

            hour   = (int)rest;
            rest   = (rest - hour) * 60;
            minute = (int)rest;
            rest   = (rest - minute) * 60;
            sec    = Math.Round(rest);

            year  = (int)((time.days - 15078.2) / 365.25);
            month = (int)((time.days - 14956.1 - (int)(year * 365.25)) / 30.6001);
            date  = time.days - 14956 - (int)(year * 365.25) - (int)(month * 30.6001);
            if (year > 100)
            {
                year -= 100;
            }
            month = month - 1;
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: YangRiverJiang/DateTrans
 private void on_modify_doy(object sender, EventArgs e)
 {
     if (editing)
     {
         return;
     }
     editing = true;
     try
     {
         doy = int.Parse(textBox9.Text);
         cur.change_to_doy(doy);
         mjd  = new MJDTime(cur);
         gpst = new GPSTime(mjd);
         lc   = cur.offset_hour(time_differ);
         update();
         label6.Text = "";
     }
     catch (Exception exce)
     {
         label6.Text = "猪";
     }
     editing = false;
 }