示例#1
0
        public static int MinutesTillNext(TimeSlot Next, TimeSpan Delta)
        {
            DateTime temp = Next.Start;

            temp += Delta;
            temp  = temp.AddYears(DateTime.Now.Year - 1);
            //temp = temp.AddDays(DateTime.Now.Day-1);
            //temp = temp.AddMonths(DateTime.Now.Month-1);
            TimeSpan diff = temp.Subtract(DateTime.Now);

            return(Convert.ToInt32(diff.TotalMinutes));
        }
示例#2
0
        public static double CurrentProgress(TimeSlot Current, TimeSpan Delta)
        {
            double   Length = Current.End.Subtract(Current.Start).TotalSeconds;
            DateTime temp   = Current.Start;

            temp += Delta;
            temp  = temp.AddYears(DateTime.Now.Year - 1);
            //temp = temp.AddMonths(DateTime.Now.Month-1);
            //temp = temp.AddDays(DateTime.Now.Day-1);
            double NowStartDiff = DateTime.Now.Subtract(temp).TotalSeconds;

            return(NowStartDiff / Length);
        }
示例#3
0
        private List <List <FlowData> > SplitIntoYears(List <FlowData> data)
        {
            List <List <FlowData> > result = new();
            var upLimit   = new DateTime(data[0].Date.Year + 1, 4, 1);
            var downLimit = upLimit.AddYears(-1);

            while (upLimit < data.Max(x => x.Date))
            {
                var items = data
                            .Where(x => x.Date > downLimit && x.Date < upLimit)
                            .Select(x => x);
                result.Add(items.ToList());
                upLimit  += new TimeSpan(365, 6, 0, 0);
                downLimit = upLimit.AddYears(-1);
            }

            return(result);
        }