我如何从另一个刻度中减去刻度
本文关键字:另一个 | 更新日期: 2023-09-27 18:02:38
结果如下:
从会话
中获取loginstart
的定时句柄var markStored = PPSession.TimingMarks["loginstart"];
get ticks from utcnow
var markNow = PPSession.TimingMarks["loginstart"]
= new TimingMark { endTime = DateTime.UtcNow.Ticks };
并且想要从存储的刻度中减去电流
diff = markStored - markNow;
最后一行有几个问题:
- 首先,
markNow
是TimingMark
,所以除非您覆盖了-
操作符,否则您应该指定其中的属性是您想要用于执行-
操作的属性(否则就像说object - object
) - 和上面一样-同样对于你的
markStored
,你应该指定你想要做-
的时间属性
:
var diff = markStored.timeField.Ticks - markNow.endTime;
和存根数据:
var markStored = new { Time = DateTime.Now };
var markNow = new { endTime = DateTime.UtcNow.Ticks };
var diff = markStored.Time.Ticks - markNow.endTime;