[Pkg-pascal-devel] help needed

Abou Al Montacir abou.almontacir at sfr.fr
Fri Nov 20 14:12:32 UTC 2015

On Fri, 2015-11-20 at 14:03 +0100, Paul Gevers wrote:
> Now including the patch...
> On 20-11-15 14:02, Paul Gevers wrote:
> > Hi all,
> > 
> > On 19-11-15 23:06, Abou Al Montacir wrote:
> > > Your patch looks fine, but I don't know if upstream will like adding
> > > this unit in the dependency of the compiler. Can't you pass the date
> > > into another format?
> > 
> > In the mean time I managed to get a patch working which indeed did just
> > that. However, I still would like to get SOURCE_DATE_EPOCH to be
> > supported, because that is what is spec'ed, so I think that it is the
> > only variable that makes a chance of being accepted by upstream.
> > 
> > For review, I added my current patch. I saw somewhere¹ that you can
> > change the date reported by Date via a "With TS do" construction. So I
> > think it would be great if we can convert SOURCE_DATE_EPOCH in
> > fpcsrc/compiler/scanner.pas to fpc time before calling getdatestr.
> > 
> > I haven't tried if I have the same issue with the DateUtils unit in this
> > file, but I expect the underlaying problem to be the same. I will still
> > try to figure this out, so thank Abou for the idea.
> > 
> > Paul
For sure this patch is ugly compared to the first one. It definitely affects the
compiler when compiling other programs also.
I'd prefer some thing like similar to your first path but where your variable contains the SOURCE_DATE_EPOCH in the format of Date function output.
Function UnixToDateTime(const AValue: Int64): TDateTime;
  Result:=IncSecond(UnixEpoch, AValue);
Function IncSecond(const AValue: TDateTime; const ANumberOfSeconds: Int64): TDateTime;
  Result:=AValue+ANumberOfSeconds / SecsPerDay;
Procedure MaybeSkipTimeWarp(OldDate: TDateTime; var NewDate: TDateTime);
  if (OldDate>0) and (NewDate<0) then
  else if (OldDate<-1.0) and (NewDate>-1.0) then
You can also put all this code in makefile or in a function that you add it in your patch. We are talking about 3 lines of code here.
Abou Al Montacir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-pascal-devel/attachments/20151120/1c399734/attachment.html>

More information about the Pkg-pascal-devel mailing list