c#中的时间差问题!!!请问有会的么??急急急,在线呢!!!!!!!!!!!!!!1

operator2004 2004-07-07 01:03:04
请问:怎样在函数调用前后,设置时间差:如:
TprDriverCall objTPR=new TprDriverCall();
//(1) Call Api: TprDeviceOpen
if("TprDeviceOpen" ==aCaller.FuncName )
{
try
{
OpenData op;
CommonParamData cmpd;
try
{
op =(OpenData)obaParamList[0];
cmpd =(CommonParamData)obaParamList[1];
}
catch
{
throw new System.Exception("Param is not right!");
}
objTPR.TprDeviceOpen(op,out cmpd);
aCaller.DisplayResult(cmpd);
}
catch
{
}
}
再者个函数的前后写???该怎么写???急啊!!!!!
...全文
199 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ffb 2004-12-20
  • 打赏
  • 举报
回复
用DateTime 的话如果恰好执行过程中认为修改了系统时间怎么办?
wellshddelphi 2004-12-07
  • 打赏
  • 举报
回复
sc
purpo 2004-07-08
  • 打赏
  • 举报
回复
秒出来了,精确到毫秒那还不Very Easy??
operator2004 2004-07-07
  • 打赏
  • 举报
回复
时间差的表示形式是这样的:2004-7-07-13:37:23:869
xiangyangsunboy1 2004-07-07
  • 打赏
  • 举报
回复
DateTime oldTime=DateTime.Now;
//函数。。。。。
DateTime newTime=DateTime.Now;
TimeSpan ts = newTime - oldTime;
int differenceInSeconds = ts.Seconds*1000;
chieftech 2004-07-07
  • 打赏
  • 举报
回复
System.TimeSpan span = GetMaxTime(ContentID) - GetMinTime(ContentID);
int Mins = span.Minutes + 60 * span.Hours + 60 * 24 * span.Days;
operator2004 2004-07-07
  • 打赏
  • 举报
回复
不好意思我要精确到毫秒啊啊

purpo 2004-07-07
  • 打赏
  • 举报
回复
DateTime oldTime=DateTime.Now;
//函数。。。。。
DateTime newTime=DateTime.Now;
TimeSpan ts = newTime - oldTime;
//以下为相差的时间:以天计
int differenceInDays = ts.Days;
Console.WriteLine("Difference in days: {0} ", differenceInDays);
//以下为相差的时间:以小时计
int differenceInHours = ts.Hours;
Console.WriteLine("Difference in hours: {0} ", differenceInHours);
//以下为相差的时间:以秒计
int differenceInSeconds = ts.Seconds;
Console.WriteLine("Difference in second s: {0} ", differenceInSeconds);

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧