Recent

Author Topic: Timezone  (Read 1519 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Timezone
« on: July 01, 2020, 09:06:22 pm »
Trying to implement an example I found  at  https://wiki.freepascal.org/PascalTZ.

Created a directory and installed the timezone "tzdata'.  I get the error in the use clause that it can't find uPascalTZ.

What am I doing wrong.


Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics,
  9.   DateUtils, uPascalTZ, Dialogs;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     procedure FormCreate(Sender: TObject);
  17.  
  18.   private
  19.  
  20.   public
  21.  
  22.   end;
  23.  
  24. var
  25.   Form1: TForm1;
  26.   PascalTZ: TPascalTZ;
  27.   DateTime: TDateTime;
  28.  
  29. implementation
  30.  
  31. {$R *.lfm}
  32.  
  33. { TForm1 }
  34.  
  35. procedure TForm1.FormCreate(Sender: TObject);
  36. begin
  37.   PascalTZ := TPascalTZ.Create;
  38.   PascalTZ.DatabasePath := 'tzdata';
  39. end;
  40.  
  41. end.
  42.  
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: Timezone
« Reply #1 on: July 01, 2020, 09:31:03 pm »
Hi

Did you install the Component Package, note the component is available using OPM.

The TZ icon will appear in the MISC section of your components pallete.


The best way to get accurate information on the forum is to post something wrong and wait for corrections.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Timezone
« Reply #2 on: July 01, 2020, 09:52:19 pm »
No I haven't. I just looked and I thought to add a package to the IDE was under Tools but I don't see it.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Timezone
« Reply #3 on: July 01, 2020, 10:46:52 pm »
Hi!

Hopefully the data base is suffient clever.

There are really strange things in the time zone DB :

Kiribati and  Hawaii are around at the same longitude.

Hawaii is UTC -10 h
Kiribati is UTC + 14 h

Yes! Kiribati is allways 24 h ahead of Hawaii!

And the half-hour-zones getting less but are still present in a lot of coutries like India, Iran, Australia

And don't look for logic . The Central European Time is in reality the area of 3 zones from western Spain to eastern Poland.

Winni

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Timezone
« Reply #4 on: July 02, 2020, 08:46:17 am »
No I haven't. I just looked and I thought to add a package to the IDE was under Tools but I don't see it.

Not under "Tools", but under "Packages". Just one item to the left ;)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Timezone
« Reply #5 on: July 02, 2020, 08:57:24 pm »
@lucanar

Thanks. I kind of gave up on that approach to the problem. I did a demo of the problem and posted it.

Getting a little closer to a solution I hope. 
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018