Exemple #1
0
        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;
        }
Exemple #2
0
 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;
 }
Exemple #3
0
        public utc offset_hour(int h)
        {
            utc total = new utc(year, month, date, hour, minute, sec);

            if (h > 0)
            {
                if (hour + h < 24)
                {
                    total.hour += h;
                }
                else if (date < JTime.date_amount_of_month(total.year, total.month))
                {
                    total.date += 1;
                    total.hour  = total.hour - 24 + h;
                }
                else if (month <= 11)
                {
                    total.month += 1;
                    total.date   = 1;
                    total.hour   = total.hour - 24 + h;
                }
                else
                {
                    total.year += 1;
                    total.month = 1;
                    total.date  = 1;
                    total.hour  = total.hour - 24 + h;
                }
                return(total);
            }
            else if (h < 0)
            {
                h = -h;
                if (hour >= h)
                {
                    total.hour -= h;
                }
                else if (date > 1)
                {
                    total.date -= 1;
                    total.hour  = total.hour + 24 - h;
                }
                else if (month > 1)
                {
                    total.month -= 1;
                    total.date   = total.date - 1 + JTime.date_amount_of_month(total.year, total.month);
                    total.hour   = total.hour + 24 - h;
                }
                else
                {
                    total.year  -= 1;
                    total.month += 11;
                    total.date   = total.date - 1 + JTime.date_amount_of_month(total.year, total.month);
                    total.hour   = total.hour + 24 - h;
                }
                return(total);
            }
            return(total);
        }
Exemple #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);
        }
Exemple #5
0
 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;
 }
Exemple #6
0
        public MJDTime(utc time)
        {
            int y, m, temp;

            y = time.year + (time.year < 80 ? 2000 : 1900);
            m = time.month;
            if (m <= 2)
            {
                y--;
                m += 12;
            }
            temp  = (int)(365.25 * y);
            temp += (int)(30.6001 * (m + 1));
            temp += time.date;
            temp -= 679019;

            days      = temp;
            frac_day  = time.hour + time.minute / 60.0 + time.sec / 3600.0;
            frac_day /= 24.0;
        }
Exemple #7
0
 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;
 }
Exemple #8
0
 bool larger_than(utc u1)
 {
     if (year == u1.year)
     {
         if (month == u1.month)
         {
             if (date == u1.date)
             {
                 if (hour == u1.hour)
                 {
                     if (minute == u1.minute)
                     {
                         if (sec == u1.sec)
                         {
                             return(false);
                         }
                         else if (sec > u1.sec)
                         {
                             return(true);
                         }
                         else
                         {
                             return(false);
                         }
                     }
                     else if (minute > u1.minute)
                     {
                         return(true);
                     }
                     else
                     {
                         return(false);
                     }
                 }
                 else if (hour > u1.hour)
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else if (date > u1.date)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else if (month > u1.month)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else if (year > u1.year)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }