Home > Article > Backend Development > The difference between Minutes and TotalMinutes in C#
A bug was mentioned in today's test, saying that the timing of the message reminder was wrong. It was set 2 hours in advance, and the reminder was issued before it arrived.
Looked at the code
(m.ExpectReceiveTime - DateTime.Now).Minutes < (pModel.ErtDelayPrevMinutes == -999 ? 0 : pModel.ErtDelayPrevMinutes))
Executed
##
(m.ExpectReceiveTime - DateTime.Now).MinutesThe result is 55, logically it should It is 170Execution
(m.ExpectReceiveTime - DateTime.Now).TotalMinutesThe result is 169.89568451Finally modify the code to
(Convert.ToDecimal((m.ExpectReceiveTime - DateTime.Now).TotalMinutes) < (pModel.ErtDelayPrevMinutes == -999 ? 0 : pModel.ErtDelayPrevMinutes))BUG SOLVEDSupplement:
Days; //天部分 Hours; //小时部分 Milliseconds; //毫秒部分 Minutes; //分部分 Seconds; //秒部分 Ticks; //Tick 总数 TotalDays; //总天数 TotalHours; //总小时数 TotalMilliseconds; //总毫秒数 TotalMinutes; //总分钟数 TotalSeconds; //总秒数
The above is the detailed content of The difference between Minutes and TotalMinutes in C#. For more information, please follow other related articles on the PHP Chinese website!