예제 #1
0
        public TimeSpan(TimePoint s, TimePoint e)
        {
            if (s > e)
            {
                throw new Exception("TimeSpan构造错误,TimeSpan只支持同一天的一个时间段,并且开始时间点不能大于结束时间点。");
            }

            _tpPair = new Pair <TimePoint, TimePoint>(s, e);
        }
예제 #2
0
        /// <summary>
        /// 时间是否落在时间段内
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public bool IsTimeInSpan(DateTime dt)
        {
            TimePoint tempTP = new TimePoint(dt.Hour, dt.Minute);

            return(tempTP >= TimeBegin && tempTP <= TimeEnd);
        }