[fpc-pascal] Double and LongWord

Carsten Bager carsten at beas.dk
Fri Nov 22 10:56:37 CET 2013


Hi
This Function works on Intel platforms but when compiled to Arm (Linux) the right side is 
calculated as a LongWord.

Const
  cSecondsPerDay=86400.0;
  cTimeDate2UnixFiledateStart=25569.0;
  cUnixFileDateDateTimeStart=cSecondsPerDay*cTimeDate2UnixFiledateStart;

Function UnPackUnixTime2DateTime(UnixTime:LongWord):TDateTime;
Begin
  UnPackUnixTime2DateTime:=(UnixTime+cUnixFileDateDateTimeStart)/cSecondsPerDay;
End;

---

If I change the line to

UnPackUnixTime2DateTime:=(UnixTime+Double(cUnixFileDateDateTimeStart))/Double(cSe
condsPerDay);

It works

I am not sure if this is an error or not, but al previous compilers I have worked with, change to 
real calculation on the right side when constants included, is defined as real constants.

---

What do you think?


The compiler used is
Free Pascal Compiler version 2.6.2 [2013/07/16] for arm
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for ARM


Regards
Carsten




More information about the fpc-pascal mailing list