Welcome, Guest
Username: Password: Remember me
General discussions, feature requests for CodeTyphon Project and discussions that don't fit in any of the other specific CodeTyphon forum categories.
  • Page:
  • 1

TOPIC:

UniversalTimeToLocal and LocalTimeToUniversal 8 years 9 months ago #7902

  • Dinko
  • Dinko's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 91
  • Thank you received: 5
I have problem with these functions from dateutils.
It seems to me that add and subtract operators are not correct in these functions.
Check out this little code for test. On windows environment and my timezone I can not get correct result.
Maybe somebody can confirm this.
I CodeTyphon 5.4.0 with FPC 3.1.1. It seem to me that this is problem of fpc source.

procedure TForm1.TestUTC;
var MyLocalDate: TDateTime;
MyUTCDate: TDateTime;
begin
MyLocalDate := Now;
MyUTCDate := dateutils.LocalTimeToUniversal(MyLocalDate);
ShowMessage('LocalDate: ' + FormatDateTime('yyyy-mm-dd hh:nn:ss.zzzzz', MyLocalDate) + #13#10 +
'UTCDate: ' + FormatDateTime('yyyy-mm-dd hh:nn:ss.zzzzz', MyUTCDate));
end;


I this that correct code should be like that:
function UniversalTimeToLocal(UT: TDateTime; TZOffset : Integer): TDateTime;

begin
if (TZOffset > 0) then
Result := UT - EncodeTime(TZOffset div 60, TZOffset mod 60, 0, 0)
else if (TZOffset < 0) then
Result := UT + EncodeTime(Abs(TZOffset) div 60, Abs(TZOffset) mod 60, 0, 0)
else
Result := UT;
end;

Function LocalTimeToUniversal(LT: TDateTime;TZOffset: Integer): TDateTime;

begin
if (TZOffset > 0) then
Result := LT + EncodeTime(TZOffset div 60, TZOffset mod 60, 0, 0)
else if (TZOffset < 0) then
Result := LT - EncodeTime(Abs(TZOffset) div 60, Abs(TZOffset) mod 60, 0, 0)
else
Result := LT;
end;

Regards, Dinko

PS: Congratulations for CT540. You fixed many issues. I skipped 5.20 and 5.30 because of lazreport problems, dateutils, some indy problems, but so far 5.40 seem to be good (except for this problem - but I found way to avoid that in my project).
I think that 5.40 and fpc 3.1.1. is little bit faster than CT5.10. I wonder, if it is not a secret, hom many programers you have involved in Typhon project :-) ?

Please Log in or Create an account to join the conversation.

UniversalTimeToLocal and LocalTimeToUniversal 8 years 9 months ago #7903

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4518
  • Thank you received: 1102
Thanks Sir
we will test and Fix

Now, the Core Programmers are 5-7 people.
Plus, 10- 25 students from local university,
They are learning and practicing on CT Pascal, OSes and helping us for some other actions.
The productivity of second group however, at least for now, is limited due to their lack of experience,
but the future is on our side.... :)

PS: My suggestion is to test and LAB CT 5.5, has more fixes
PilotLogic Architect and Core Programmer
The following user(s) said Thank You: Dinko

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.

UniversalTimeToLocal and LocalTimeToUniversal 8 years 9 months ago #7904

  • usbdoo
  • usbdoo's Avatar
  • Visitor
  • Visitor
Excellent work for the incredible work of the whole team.
CT is a very short time progressed to becoming more stable.
Congratulations the whole team.

Please Log in or Create an account to join the conversation.

Last edit: by usbdoo.

UniversalTimeToLocal and LocalTimeToUniversal 8 years 9 months ago #7905

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4518
  • Thank you received: 1102
Thanks Sir
At the end of CodeTyphon GENERATION V Plan (5.x)
our "Vision" is an Enterprise FREE Programming Studio.

With help from Object Pascal Community,
we hope to make our vision reality...
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.

UniversalTimeToLocal and LocalTimeToUniversal 8 years 9 months ago #7906

  • usbdoo
  • usbdoo's Avatar
  • Visitor
  • Visitor
The winner is the one who placed the long-term real goal.
Each journey begins with a first step.
Here's a great enthusiast for CT.
Anything is possible.

Please Log in or Create an account to join the conversation.

UniversalTimeToLocal and LocalTimeToUniversal 8 years 9 months ago #7925

  • Dinko
  • Dinko's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 91
  • Thank you received: 5
It seems to me that your team is made of very capable programmers :-)
Thanks for the project.
I think CodeTyphon saved world pascal community from disappearing, especially because Embarcadero is having such version and pay policy of Delphi product. I think in future they will have to change it thanks to your and Lazarus project.

Please Log in or Create an account to join the conversation.

UniversalTimeToLocal and LocalTimeToUniversal 8 years 9 months ago #7926

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4518
  • Thank you received: 1102
Thanks Sir
The only problem is the "Pascal Trolls",
people who have been just "IDE users" for years,
people that can't compromise with the NEW Pascal Programming Reality:

1)-Pascal, (NOT Delphi Pascal, it's NOT the same) it's powerful like C/C++ Now and in some cases more powerful:
For example: We can build and release DEV++ with CT and give to C/C++ programmers the ability to have a C/C++ IDE of Solaris, FreeBSD, etc

2)-Pascal Community Now, has CodeTyphon Studio, FREE, Open Source, TERRA, Enterprise platform, to build code on it... with NO limits.

3)-Pascal Community Now, has PilotLogic Software House to support all the above and to continue for the vision...

and last but not least, This Pascal Community is OPEN to everyone....
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • Page:
  • 1