Subject | Re: Timestamp difference Windows / Linux |
---|---|
Author | roydamman |
Post date | 2008-08-18T15:58:06Z |
Hello,
// timestamp_date: days since 17 Nov 1858
// timestamp_time: milliseconds * 10 since midnight
procedure isc_decode_timestamp(piscquadIn: PISC_QUAD; var rdatetime:
TDateTime);
var
pisctimestamp: PISC_TIMESTAMP;
begin
pisctimestamp := PISC_TIMESTAMP(piscquadIn);
rdatetime := pisctimestamp^.timestamp_time / 864000000 +
pisctimestamp^.timestamp_date - 15018;
end;
procedure isc_encode_timestamp(datetimeIn: TDateTime; piscquadOut:
PISC_QUAD);
var
pisctimestamp: PISC_TIMESTAMP;
begin
pisctimestamp := PISC_TIMESTAMP(piscquadOut);
pisctimestamp^.timestamp_date := Trunc(datetimeIn) + 15018;
pisctimestamp^.timestamp_time := Round(Frac(datetimeIn) * 864000000);
end;
I hope this helps someone with the same problems,
Roy Damman
>My solution for Delphi users:
> > Shouldn't there be a
> > parse method who can decently parse this value to the highest
> > precision?
>
> Maybe there should. Feel free to add a RFE into the tracker. But you
> have to parse the milliseconds yourself for the time being, sorry.
>
// timestamp_date: days since 17 Nov 1858
// timestamp_time: milliseconds * 10 since midnight
procedure isc_decode_timestamp(piscquadIn: PISC_QUAD; var rdatetime:
TDateTime);
var
pisctimestamp: PISC_TIMESTAMP;
begin
pisctimestamp := PISC_TIMESTAMP(piscquadIn);
rdatetime := pisctimestamp^.timestamp_time / 864000000 +
pisctimestamp^.timestamp_date - 15018;
end;
procedure isc_encode_timestamp(datetimeIn: TDateTime; piscquadOut:
PISC_QUAD);
var
pisctimestamp: PISC_TIMESTAMP;
begin
pisctimestamp := PISC_TIMESTAMP(piscquadOut);
pisctimestamp^.timestamp_date := Trunc(datetimeIn) + 15018;
pisctimestamp^.timestamp_time := Round(Frac(datetimeIn) * 864000000);
end;
I hope this helps someone with the same problems,
Roy Damman