|
@@ -4,7 +4,7 @@
|
|
Date and time functions.
|
|
Date and time functions.
|
|
|
|
|
|
Copyright (C) 2009-2012 Przemysław Nagay ([email protected])
|
|
Copyright (C) 2009-2012 Przemysław Nagay ([email protected])
|
|
- Copyright (C) 2017-2018 Alexander Koblov ([email protected])
|
|
|
|
|
|
+ Copyright (C) 2017-2022 Alexander Koblov ([email protected])
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
it under the terms of the GNU General Public License as published by
|
|
@@ -464,6 +464,7 @@ end;
|
|
function DateTimeToUnixFileTime(DateTime : TDateTime): TUnixFileTime;
|
|
function DateTimeToUnixFileTime(DateTime : TDateTime): TUnixFileTime;
|
|
{$IF DEFINED(UNIX)}
|
|
{$IF DEFINED(UNIX)}
|
|
var
|
|
var
|
|
|
|
+ AUnixTime: TTime;
|
|
ATime: TTimeStruct;
|
|
ATime: TTimeStruct;
|
|
Year, Month, Day: Word;
|
|
Year, Month, Day: Word;
|
|
Hour, Minute, Second, MilliSecond: Word;
|
|
Hour, Minute, Second, MilliSecond: Word;
|
|
@@ -484,10 +485,13 @@ begin
|
|
ATime.tm_min:= Minute;
|
|
ATime.tm_min:= Minute;
|
|
ATime.tm_sec:= Second;
|
|
ATime.tm_sec:= Second;
|
|
|
|
|
|
- Result:= fpMkTime(@ATime);
|
|
|
|
|
|
+ AUnixTime:= fpMkTime(@ATime);
|
|
|
|
|
|
- if Result = DCBasicTypes.TFileTime(-1) then
|
|
|
|
- raise EDateOutOfRange.Create(DateTime)
|
|
|
|
|
|
+ if (AUnixTime < 0) then
|
|
|
|
+ Result:= 0
|
|
|
|
+ else begin
|
|
|
|
+ Result:= TUnixFileTime(AUnixTime);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
{$ELSE}
|
|
{$ELSE}
|
|
var
|
|
var
|