ACE日期时间类比较少,常用就是下面2个类
ACE_DateTime
ACE_Time_Value
ACE_DateTime用于获得和设置当前日期/时间,其没有提供运算操作,精确到毫秒
ACE_Time_Value 主要用于时间统计,精确到微妙,提供了运算操作
要获得当前的时间,可调用 ACE_OS::gettimeofday()
其提供的msec,usec均表示当前变量中保存的时间的总和
如下:
ACE_Time_Value sdate(ACE_OS::gettimeofday()) ;
...
ACE_Time_Value edate(ACE_OS::gettimeofday()) ;
ACE_DEBUG((LM_DEBUG,"总共历时%d毫秒!",(sdate-edate).msec()));
ACE_DEBUG((LM_DEBUG,"总共历时%d微秒!",(sdate-edate).usec()));
ACE_DateTime类提供了个update函数,用于和ACE_Time_Value进行交互