[fpc-pascal] Local Time
My problem is that I get UTC time with the 220 compiler on the Arm platform, when using gettime, now ---. If i compile my program "lt" (local time) with the 220 compiler on Linux 386 it works as I expects. If I compile it to an Arm Linux it fails but if I use the 204 compiler it works. I have to use the 220 compiler on my project. Is there a way around this problem. Regards Carsten Output from 220 compiler on 386 Linux LTC:21/02-2008 8:59:20:416 UTC:21/02-2008 7:59:20:00 Output from 220 compiler on Arm Linux Thu Feb 21 08:02:35 UTC 2008 LTC:21/02-2008 8:02:25:656 UTC:21/02-2008 8:03:45:00 Output from 204 compiler on Arm Linux LTC:21/02-2008 8:50:48:421 UTC:21/02-2008 7:50:48:00 {Datotid test program} {$mode objfpc} {$LONGSTRINGS OFF} {$IFDEF DEBUG} {Compileren kan leverer denne definition} {$RANGECHECKS ON} { $OVERFLOWCHECKS ON} {Der er problemer med denne paa ARM 9} {$S+ STACK CHECKING ON} {$SMARTLINK ON} {$TYPEINFO ON} {$DEFINE DEBUGCALNANOX} {$ENDIF} Program lt; Uses unix, Swrite, baseunix, sysutils; {System} Var SystemTime:TSystemTime; DateTime:TDateTime; Procedure GetUtcTime(var SystemTime: TSystemTime); Var DateTime:TDateTime; Begin DateTime:=(fptime / 86400.0) + 25569; DateTimeToSystemTime(DateTime,SystemTime); End; Function SystemTimeToStr(dt:TSystemTime):shortstring; Begin SystemTimeToStr:=intToStrR(dt.Day,2)+'/'+ intToStr0(dt.Month,2)+'-'+ intToStr0(dt.Year,4)+ intToStrR(dt.Hour,3)+':'+ intToStr0(dt.Minute,2)+':'+ intToStr0(dt.Second,2)+':'+ intToStr0(dt.MilliSecond,2); End; Begin GetLocalTime(SystemTime); WriteLn('LTC:',SystemTimeToStr(SystemTime)); GetUtcTime(SystemTime); WriteLn('UTC:',SystemTimeToStr(SystemTime)); End. Med venlig hilsen Carsten Bager BEAS A/S Brørupvænget 10 DK-7650 Bøvlingbjerg Tlf. : +45 9788 5222 Fax : +45 9788 5434 www.beas.dk ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Local Time
Carsten Bager schrieb: > My problem is that I get UTC time with the 220 compiler on the Arm > platform, when using gettime, now ---. > If i compile my program "lt" (local time) with the 220 compiler on Linux 386 > it works as I expects. > If I compile it to an Arm Linux it fails but if I use the 204 compiler it > works. > I have to use the 220 compiler on my project. Is there a way around this > problem. Can you post straces? > > Regards > Carsten > > Output from 220 compiler on 386 Linux > LTC:21/02-2008 8:59:20:416 > UTC:21/02-2008 7:59:20:00 > > Output from 220 compiler on Arm Linux > Thu Feb 21 08:02:35 UTC 2008 > LTC:21/02-2008 8:02:25:656 > UTC:21/02-2008 8:03:45:00 > > Output from 204 compiler on Arm Linux > LTC:21/02-2008 8:50:48:421 > UTC:21/02-2008 7:50:48:00 > > > > > {Datotid test program} > > {$mode objfpc} > {$LONGSTRINGS OFF} > > {$IFDEF DEBUG} {Compileren kan leverer denne definition} > {$RANGECHECKS ON} > { $OVERFLOWCHECKS ON} {Der er problemer med denne paa > ARM 9} > {$S+ STACK CHECKING ON} > {$SMARTLINK ON} > {$TYPEINFO ON} > {$DEFINE DEBUGCALNANOX} > {$ENDIF} > > Program lt; > Uses unix, > Swrite, > baseunix, > sysutils; {System} > > > > Var > SystemTime:TSystemTime; > DateTime:TDateTime; > > > > > > Procedure GetUtcTime(var SystemTime: TSystemTime); > Var > DateTime:TDateTime; > Begin > DateTime:=(fptime / 86400.0) + 25569; > DateTimeToSystemTime(DateTime,SystemTime); > End; > > > > > Function SystemTimeToStr(dt:TSystemTime):shortstring; > Begin > SystemTimeToStr:=intToStrR(dt.Day,2)+'/'+ >intToStr0(dt.Month,2)+'-'+ >intToStr0(dt.Year,4)+ >intToStrR(dt.Hour,3)+':'+ >intToStr0(dt.Minute,2)+':'+ >intToStr0(dt.Second,2)+':'+ >intToStr0(dt.MilliSecond,2); > End; > > Begin > GetLocalTime(SystemTime); > WriteLn('LTC:',SystemTimeToStr(SystemTime)); > GetUtcTime(SystemTime); > WriteLn('UTC:',SystemTimeToStr(SystemTime)); > End. > Med venlig hilsen > Carsten Bager > > BEAS A/S > Brørupvænget 10 > DK-7650 Bøvlingbjerg > Tlf. : +45 9788 5222 Fax : +45 9788 5434 > www.beas.dk > > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Local Time
On 21 Feb 2008, at 09:15, Carsten Bager wrote: My problem is that I get UTC time with the 220 compiler on the Arm platform, when using gettime, now ---. If i compile my program "lt" (local time) with the 220 compiler on Linux 386 it works as I expects. If I compile it to an Arm Linux it fails but if I use the 204 compiler it works. Under Linux, FPC tries to read the timezone info from (in this order) /etc/timezone /etc/localtime /usr/lib/zoneinfo/localtime I guess the Linux on your Arm device stores it in yet another place (or one of these files exist but does not contain the correct time zone info). Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Local Time
> > Can you post straces? I can not run strace on my Arm9 platform. Is there another way. CarstenMed venlig hilsen Carsten Bager BEAS A/S Brørupvænget 10 DK-7650 Bøvlingbjerg Tlf. : +45 9788 5222 Fax : +45 9788 5434 www.beas.dk ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Local Time
> > On 21 Feb 2008, at 09:15, Carsten Bager wrote: > > > My problem is that I get UTC time with the 220 compiler on the Arm > > platform, when using gettime, now ---. > > If i compile my program "lt" (local time) with the 220 compiler on > > Linux 386 > > it works as I expects. > > If I compile it to an Arm Linux it fails but if I use the 204 > > compiler it works. > > Under Linux, FPC tries to read the timezone info from (in this order) > > /etc/timezone > /etc/localtime > /usr/lib/zoneinfo/localtime > > I guess the Linux on your Arm device stores it in yet another place > (or one of these files exist but does not contain the correct time > zone info). As I wrote in my first mail. The same program compiled with the 204 compiler works on the same Arm 9 platform. So the program compiled with the 204 compiler finds the "/etc/localtime" file and reads it. Carsten ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Local Time
I tried the 221 compiler. The error I reported is gone here, but there still is something fishy about it. When running the 204 program my UTC time is always updated with the correct time. But when running the 221 program the time can be behind by several minutes. I then rewrote my GetUtcTime procedure to: Procedure GetUtcTime(var SystemTime: TSystemTime); Var DateTime:TDateTime; fptimeS:TDateTime; Begin fptimeS:=fptime; DateTime:=(fptimeS / 86400.0) + 25569.0; DateTimeToSystemTime(DateTime,SystemTime); End; From Procedure GetUtcTime(var SystemTime: TSystemTime); Var DateTime:TDateTime; Begin DateTime:=(fptime / 86400.0) + 25569; DateTimeToSystemTime(DateTime,SystemTime); End; Now it works I would not expect to run in to trouble mixing real and integers when having real on both the right and left side. What do you say. Regards Carsten 204 compiler on Arm 9 LTC:21/02-2008 13:53:17:944 UTC:21/02-2008 12:53:17:00 221 compiler on Arm 9 LTC:21/02-2008 13:54:41:925 UTC:21/02-2008 12:56:15:00 Med venlig hilsen Carsten Bager BEAS A/S Brørupvænget 10 DK-7650 Bøvlingbjerg Tlf. : +45 9788 5222 Fax : +45 9788 5434 www.beas.dk ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Local Time
I tried the 221 compiler. The error I reported is gone here, but there still is something fishy about it. When running the 204 program my UTC time is always updated with the correct time. But when running the 221 program the time can be behind by several minutes. I then rewrote my GetUtcTime procedure to: Procedure GetUtcTime(var SystemTime: TSystemTime); Var DateTime:TDateTime; fptimeS:TDateTime; Begin fptimeS:=fptime; DateTime:=(fptimeS / 86400.0) + 25569.0; DateTimeToSystemTime(DateTime,SystemTime); End; From Procedure GetUtcTime(var SystemTime: TSystemTime); Var DateTime:TDateTime; Begin DateTime:=(fptime / 86400.0) + 25569; DateTimeToSystemTime(DateTime,SystemTime); End; Now it works I would not expect to run in to trouble mixing real and integers when having real on both the right and left side. What do you say. Regards Carsten 204 compiler on Arm 9 LTC:21/02-2008 13:53:17:944 UTC:21/02-2008 12:53:17:00 221 compiler on Arm 9 LTC:21/02-2008 13:54:41:925 UTC:21/02-2008 12:56:15:00 Med venlig hilsen Carsten Bager BEAS A/S Brørupvænget 10 DK-7650 Bøvlingbjerg Tlf. : +45 9788 5222 Fax : +45 9788 5434 www.beas.dk ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Local Time
On 21 Feb 2008, at 14:22, Carsten Bager wrote: I would not expect to run in to trouble mixing real and integers when having real on both the right and left side. What do you say. http://wiki.freepascal.org/User_Changes_2.2.0#Floating_point_constants Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] the libc unit (again)
Hello, I find more and more units and components (for Lazarus) that are using the libc unit. I find it really problematic, because it doesn't exists for all platforms and architectures, so why not markring the unit as obsolete for the next FPC release so other developers will have to work with more flexible units ? Thanks, Ido -- http://ik.homelinux.org/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal