Пример #1
0
        public async Task SendAsync(IConnection connection, CancellationToken cancellationToken = default)
        {
            connection.AddTags(Span2);

            var dispatch = _random.Next(200, 1000);

            using var dispatchSpan = Span2.EncodingSpan();
            //await Task.Delay(dispatch);

            using var encodingSpan = dispatchSpan.DispatchSpan(this);
            var encoding = _random.Next(200, 1000);
            //await Task.Delay(encoding);
        }
Пример #2
0
        /// <summary>
        /// Addition operator
        /// </summary>
        /// <param name="Span1">Span 1</param>
        /// <param name="Span2">Span 2</param>
        /// <returns>The combined date span</returns>
        public static DateSpan operator +(DateSpan Span1, DateSpan Span2)
        {
            if (Span1.IsNull() && Span2.IsNull())
            {
                return(null);
            }
            if (Span1.IsNull())
            {
                return(new DateSpan(Span2.Start, Span2.End));
            }
            if (Span2.IsNull())
            {
                return(new DateSpan(Span1.Start, Span1.End));
            }
            DateTime Start = Span1.Start < Span2.Start ? Span1.Start : Span2.Start;
            DateTime End   = Span1.End > Span2.End ? Span1.End : Span2.End;

            return(new DateSpan(Start, End));
        }