#1 2018-03-23 11:20:57

DigDiver
Member
Registered: 2013-04-29
Posts: 137

TSynSystemTime serious bug

The TSystemTime record in Winapi.Windows defained as:

  _SYSTEMTIME = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;

The TSynSystemTime defained as:

  TSynSystemTime = {$ifdef ISDELPHI2006ANDUP}record{$else}object{$endif}
    Year, Month, Day, DayOfWeek,
    Hour, Minute, Second, MilliSecond: word;

See the wrong order of Day and DayOfWeek in TSynSystemTime declaration

So function FromNowUTC returns  3/5/2018 11:17:25 AM instead of 3/23/2018 11:17:25 AM


procedure TSynSystemTime.FromNowUTC;
begin
  {$ifdef MSWINDOWS}
  GetSystemTime(TSystemTime(self)); // this API is fast enough for our purpose
  {$else}
  GetNowUTCSystem(TSystemTime(self));
  {$endif}
end;

Offline

#2 2018-03-23 13:29:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,669
Website

Re: TSynSystemTime serious bug

Oups....

Please check https://synopse.info/fossil/info/c97a77cf9c

Edit:
In fact, the format we followed was the one used by FPC... which is not compatible with the one from the Windows unit!
So we need to fix the code to support FPC non Windows platforms.
See https://synopse.info/fossil/info/6bb8a92474

Offline

#3 2018-03-24 10:05:29

DigDiver
Member
Registered: 2013-04-29
Posts: 137

Re: TSynSystemTime serious bug

Thanks, fix works fine.

Offline

Board footer

Powered by FluxBB