[fpc-devel] NowUTC in FPC

Michael Van Canneyt michael at freepascal.org
Mon Aug 1 11:53:53 CEST 2016

On Mon, 1 Aug 2016, Denis Kozlov wrote:

> On 01/08/2016 07:59, Michael Van Canneyt wrote:
>> But that would create duplicated code of LocalTimeToUniversal, 
>> UnixToDateTime, IncMilliSecond functions in SysUtils and DateUtils.
>> So what ? It is essentially A+B*C or some variant of that.
> I try to avoid code duplication, which unnecessarily increases maintenance 
> efforts.

One must weigh always weigh the advantages over the disadvantages.
Consistency and design of the API have also their purpose.

If I didn't care about that, I would simply have added it to dateutils.
As it is now, dateutils is 100% portable. By introducing a dependency on the
OS, this is no longer true, and I think that should be avoided.

>> Since you seem reluctant, no problem, I will do it myself.
> I'm asking for guidance to make sure I do it the right way.

In that case, just copy the implementation of the functions involved.

> Is it really so bad to include DateUtils in RTL?

Yes. It was specially removed to keep the RTL as small as possible.

To move it back for the sake of some multiplications and additions is not an
option IMHO.


More information about the fpc-devel mailing list