[fpc-pascal] Local Time

Florian Klaempfl florian at freepascal.org
Thu Feb 21 09:20:52 CET 2008


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 at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 




More information about the fpc-pascal mailing list