private static TimeSpan GetTimeSpanFromItem(ushort time, byte elapsedunit, out uint count, out timeUnitType unit, out bool specified)
        {
            TimeSpan zero;
            specified = true;
            switch (elapsedunit)
            {
                case 1:
                    zero = TimeSpan.FromHours((double) time);
                    count = time;
                    unit = timeUnitType.hours;
                    return zero;

                case 2:
                    zero = TimeSpan.FromDays((double) time);
                    count = time;
                    unit = timeUnitType.days;
                    return zero;

                case 3:
                    zero = TimeSpan.FromDays((double) (time * 7));
                    count = time;
                    unit = timeUnitType.weeks;
                    return zero;
            }
            specified = false;
            zero = TimeSpan.Zero;
            count = 0;
            unit = timeUnitType.days;
            return zero;
        }
        private static TimeSpan GetTimeSpanFromItem(ushort time, byte elapsedunit, out uint count, out timeUnitType unit, out bool specified)
        {
            TimeSpan zero;

            specified = true;
            switch (elapsedunit)
            {
            case 1:
                zero  = TimeSpan.FromHours((double)time);
                count = time;
                unit  = timeUnitType.hours;
                return(zero);

            case 2:
                zero  = TimeSpan.FromDays((double)time);
                count = time;
                unit  = timeUnitType.days;
                return(zero);

            case 3:
                zero  = TimeSpan.FromDays((double)(time * 7));
                count = time;
                unit  = timeUnitType.weeks;
                return(zero);
            }
            specified = false;
            zero      = TimeSpan.Zero;
            count     = 0;
            unit      = timeUnitType.days;
            return(zero);
        }
 public timeOffsetType() {
     this.typeField = stcBaseTypeType.simple;
     this.unitField = timeUnitType.s;
 }
 public timeCoordinateType() {
     this.unitField = timeUnitType.s;
 }
Beispiel #5
0
        private static TimeSpan GetTimeSpanFromItem(ushort time, byte elapsedunit, out uint count, out timeUnitType unit, out bool specified)
        {
            specified = true;
            TimeSpan timeSpan;

            switch (elapsedunit)
            {
            case 1:
                timeSpan = TimeSpan.FromHours((double)time);
                count    = (uint)time;
                unit     = timeUnitType.hours;
                break;

            case 2:
                timeSpan = TimeSpan.FromDays((double)time);
                count    = (uint)time;
                unit     = timeUnitType.days;
                break;

            case 3:
                timeSpan = TimeSpan.FromDays((double)((int)time * 7));
                count    = (uint)time;
                unit     = timeUnitType.weeks;
                break;

            default:
                specified = false;
                timeSpan  = TimeSpan.Zero;
                count     = 0U;
                unit      = timeUnitType.days;
                break;
            }
            return(timeSpan);
        }