Now +/- 4 seconds

Now +/- 4 seconds

Hello,

I'm using the function below to fill a SOAP request that requires a IssueInstant timestamp...from time to time, the server return a SOAP fault telling that the timestamp is up to 4 seconds in the futur...

Is there anything wrong in my code ?

function NowUTC: TDateTime;
var
Time: SYSTEMTIME;
begin
GetSystemTime(Time);
Result := SystemTimeToDateTime(Time);
end;

function XmlNow: UTF8String;
begin
Result := UTF8Encode(FormatDateTime('yyyy-mm-dd"T"hh:nn:ss"Z"', NowUTC));
end;

my PC is Windows 7 under VirtualBox and the clock seems right.

Comments

  1. Are you using NTP to sync your time?
    Does the service side do this too?
    Can you get the current date-time from the service side?

    ReplyDelete
  2. Windows is NTP synchronized with time.windows.com

    I don't have info on the server side from gouv.fr :)

    but it's look like a VirtualBox problem
    stackoverflow.com - VirtualBox - Synchronisation problems

    ReplyDelete
  3. Paul TOTH I've seen serious time sync issues with both virtual and physical windows machines using non-NTP syncing mechanisms. So ever use does NTP.

    ReplyDelete
  4. Time sync is a problem on all virtualisation platforms, and it causes all sorts of problems if you don't deal with it (like not being able to login). Kerebos security is extremely sensitive to this as it uses timestamps to protect against replay attacks etc.

    ReplyDelete

Post a Comment