Exemple #1
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);
            }
        }
Exemple #2
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);
        }