Пример #1
0
        public GPGregorianTime TimeByAddingHours(double dHours)
        {
            GPGregorianTime vc = new GPGregorianTime(this);

            vc.addDayHours(dHours / 24.0);
            return(vc);
        }
Пример #2
0
        // return values
        // 0 - DST is off, yesterday was off
        // 1 - DST is on, yesterday was off
        // 2 - DST is on, yesterday was on
        // 3 - DST is off, yesterday was on
        public int GetDaylightChangeType(GPGregorianTime vc2)
        {
            long uToday     = vc2.getTimestamp();
            long uYesterday = uToday - 86400;

            Transition tzToday     = FindActiveTransition(uToday);
            Transition tzYesterday = FindActiveTransition(uYesterday);

            bool t1 = tzToday != null ? tzToday.Dst : false;
            bool t2 = tzYesterday != null ? tzYesterday.Dst : false;

            if (t1)
            {
                if (t2)
                {
                    return(2);
                }
                else
                {
                    return(1);
                }
            }
            else if (t2)
            {
                return(3);
            }
            else
            {
                return(0);
            }
        }
Пример #3
0
 public void Copy(GPGregorianTime vc)
 {
     p_year  = vc.getYear();
     p_month = vc.getMonth();
     p_day   = vc.getDay();
     setDayHours(vc.getDayHours());
     setLocationProvider(vc.getLocationProvider());
     recalculateJulianGreenwichTime();
 }
Пример #4
0
        public double BiasHoursForDate(GPGregorianTime vc)
        {
            Transition trans = FindActiveTransition(vc.getTimestamp());

            if (trans != null)
            {
                return(Convert.ToDouble(trans.OffsetInSeconds - OffsetSeconds) / 3600.0);
            }
            return(0.0);
        }
Пример #5
0
        // vracia -1, ak zadany den je den nasledujuci po THIS
        // vracia 1 ak THIS je nasledujuci den po zadanom dni
        public int CompareYMD(GPGregorianTime v)
        {
            if (v.getYear() < getYear())
            {
                return((getYear() - v.getYear()) * 365);
            }
            else if (v.getYear() > getYear())
            {
                return((getYear() - v.getYear()) * 365);
            }

            if (v.getMonth() < getMonth())
            {
                return((getMonth() - v.getMonth()) * 31);
            }
            else if (v.getMonth() > getMonth())
            {
                return((getMonth() - v.getMonth()) * 31);
            }

            return(getDay() - v.getDay());
        }
Пример #6
0
        public bool IsBeforeThis(GPGregorianTime date)
        {
            int y1, y2, m1, m2, d1, d2;

            d1 = this.getDay();
            d2 = date.getDay();
            m1 = this.getMonth();
            m2 = date.getMonth();
            y1 = this.getYear();
            y2 = date.getYear();

            if (y1 > y2)
            {
                return(false);
            }
            else if (y1 < y2)
            {
                return(true);
            }
            else if (m1 > m2)
            {
                return(false);
            }
            else if (m1 < m2)
            {
                return(true);
            }
            else if (d1 < d2)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #7
0
 public GPGregorianTime(GPGregorianTime vc)
 {
     Copy(vc);
 }
Пример #8
0
 public bool IsLeapYear()
 {
     return(GPGregorianTime.IsLeapYear(getYear()));
 }