MSecsToTimeStamp

Convert a number of milliseconds to a TDateTime value.

Declaration

Source position: datih.inc line 115

  function MSecsToTimeStamp(MSecs: Comp) : TTimeStamp;

Description

MSecsToTimeStamp converts the given number of milliseconds to a TTimeStamp date/time notation.

Use TTimeStamp variables if you need to keep very precise track of time.

Errors

None.

See also

Name Description
DateTimeToTimeStamp Converts a TDateTime value to a TimeStamp structure.
TimeStampToMSecs Converts a timestamp to a number of milliseconds.

Example

Program Example17;
{ This program demonstrates the MSecsToTimeStamp function }
Uses sysutils;
Var MS : Comp;
    TS : TTimeStamp;
    DT : TDateTime;
Begin
  TS:=DateTimeToTimeStamp(Now);
  Writeln ('Now in days since 1/1/0001      : ',TS.Date);
  Writeln ('Now in millisecs since midnight : ',TS.Time);
  MS:=TimeStampToMSecs(TS);
  Writeln ('Now in millisecs since 1/1/0001 : ',MS);
  MS:=MS-1000*3600*2;
  TS:=MSecsToTimeStamp(MS);
  DT:=TimeStampToDateTime(TS);
  Writeln ('Now minus 1 day : ',DateTimeToStr(DT));
End.