您现在的位置:首页 >> 基础算法 >> window基础 >> 内容

Delphi中微秒转TDateTime函数MicrosecondsToTime

时间:2011/9/3 15:30:29 点击:

  核心提示:uses DateUtils;function MicrosecondsToTime(const microSeconds : TLargeInteger) : string;CONSTMicroPe...
uses DateUtils;

function MicrosecondsToTime(const microSeconds : TLargeInteger) : string;
CONST
  MicroPerMilli = 1000;
var
  dt : TDateTime;
  microSec : TLargeInteger;
begin
  dt := microSeconds / MicroPerMilli / MSecsPerSec / SecsPerDay;

  microSec := microseconds - MicroPerMilli * MilliSecondOf(dt) ;

  if microsec < 0 then
  begin
    dt := IncMilliSecond(dt,-1) ;
    microsec := MicroPerMilli + microsec;
  end;

  result := Format('%d days, %s %d', [Trunc(dt), FormatDateTime('hh:nn:ss.z', Frac(dt)), microSec]) ;
end;

Tags:函数 
作者:网络 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 盒子文章(www.2ccc.com) © 2024 版权所有 All Rights Reserved.
  • 沪ICP备05001939号