Recent

Author Topic: UTC Time question  (Read 10334 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: UTC Time question
« Reply #45 on: August 08, 2020, 09:56:42 am »
I didn't follow this thread but I heard there will be a collaborative project and my skill may be needed, that's awesome. I'm in. I should start looking for some ideas on this weekend.

Have a good weekend!

Great
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

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: UTC Time question
« Reply #46 on: August 08, 2020, 11:28:02 am »
Are we going to argue about credits. handako will have the hardest job building the graphics. Then I would have the most time culling 45.000 reccords.

Presumably you're still keeping that under your hat so I can't check whether the two (possibly three) strips visible from where I am are in it.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: UTC Time question
« Reply #47 on: August 08, 2020, 01:41:19 pm »

There is also a 15min (actually 45min) increment going up a little west of the centre of Australia. But only about 6 people live there and 2 of those don't have watches.


Hi Davo!

You should inform your gvernment.
They don't know about that:

https://info.australia.gov.au/about-australia/facts-and-figures/time-zones-and-daylight-saving

Winni

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: UTC Time question
« Reply #48 on: August 08, 2020, 02:11:20 pm »
https://en.wikipedia.org/wiki/Eucla,_Western_Australia#Time_zone

Population 53. Wp doesn't indicate how many of those are named "Bruce".

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: UTC Time question
« Reply #49 on: August 08, 2020, 02:20:40 pm »
Hi!

Allways the biggest problem with different clocks is a source where you can download a maintained table of timezones, daylight saving and its start and end.

The are nearly yearly changes. And a lot of counties have their own algorithm when daylight starts and ends (Israel, Chile, EU.....).

In the last years Russia and Turkey abolished daylight saving.
Portugal changed in the 90s to CET but returned later to UTC.
The half-hour-timezone in Iraq was eleminated after one of the US invasions.

And so on .....

So we need a reliable table to download.
Does anybody know one?

Winni

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: UTC Time question
« Reply #50 on: August 08, 2020, 02:26:14 pm »
https://en.wikipedia.org/wiki/Eucla,_Western_Australia#Time_zone

Population 53. Wp doesn't indicate how many of those are named "Bruce".

MarkMLl

Nice! And the hottest point of Australia with 49° Celsius.
Too hot to change the time .....

Winni

TRon

  • Hero Member
  • *****
  • Posts: 2432
Re: UTC Time question
« Reply #51 on: August 08, 2020, 02:38:52 pm »
So we need a reliable table to download.
Does anybody know one?
Iana ? https://www.iana.org/time-zones

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: UTC Time question
« Reply #52 on: August 08, 2020, 02:43:44 pm »
Hi!

IANAs allways up to date - but you have all the computing by yourself.

I am looking for a "ready to use" table.

Winni

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: UTC Time question
« Reply #53 on: August 08, 2020, 02:56:43 pm »
Hi!


If found in my sources the body for a analog clock.
The Image should have a size of 90 x 90:

Code: Pascal  [Select][+][-]
  1.   TForm5 = class(TForm)
  2.     Image1: TImage;
  3.     Timer1: TTimer;  
  4.    ....
  5.     procedure Image1Paint(Sender: TObject);
  6.     Procedure Timer1Timer (Sender : TObject);
  7.    .....
  8.   private
  9.     AHour : Word;
  10.     AMin : Word;
  11.     ASec : Word;
  12.    public
  13.    end;
  14.  
  15. const Deg2Rad = pi/180;
  16.  
  17.     Procedure TForm5.Timer1Timer (Sender : TObject);
  18.     var junk : word;
  19.     begin
  20.     DecodeTime(Now,AHour,AMin,ASec,Junk);
  21.     Image1.Invalidate;
  22.     end;            
  23.  
  24. // analog clock, image 90 x 90
  25. procedure TForm5.Image1Paint(Sender: TObject);
  26. const ro=20;    // Minutenzeiger
  27.       centerX=45;
  28.       centerY=47;
  29. var x,y,x1,y1,x2,y2 : integer;
  30.     h,degH, degMin, degSec, sinus, cosinus : single;
  31. begin
  32.   // hours
  33.   h := Ahour;
  34.   if h >=12 then h := h - 12;
  35.   h := h + AMin/60;
  36.   degH :=  h* 30 - 90;   // Uhr (Nord) fängt 90° vor Lazarus (Ost) an
  37.   math.sincos(degH*Deg2Rad, sinus, cosinus);
  38.   x := round (cosinus*ro*0.75)+centerX;
  39.   y := round (sinus *ro*0.75) +CenterY;
  40.   // minutes
  41.   degMin :=  Amin*6 -90;
  42.   math.sincos(degMin*Deg2Rad, sinus, cosinus);
  43.   x1 := round (cosinus*ro)+centerX;
  44.   y1 := round (sinus*ro)+centerY;
  45.   // seconds
  46.   degSec := ASec*6 -90;
  47.   math.sincos(degSec*Deg2Rad, sinus, cosinus);
  48.   x2 := round (cosinus*ro*1.15)+centerX;
  49.   y2 := round (sinus*ro*1.15)+centerY;
  50.   with Image1.Canvas do
  51.       begin
  52.       pen.width := 5;
  53.       pen.Color := clBlack;
  54.       pen.EndCap :=   pecRound;
  55.       line(centerX, centerY,x,y);  // hours
  56.       line(centerX, centerY,x1,y1);   // minutes
  57.       pen.width := 1;
  58.       brush.Color := clLime;
  59.       EllipseC(x,y,3,3);    // radium, luminous lime-green, very 60th
  60.       EllipseC(x1,y1,3,3);
  61.       pen.Color := clRed;
  62.       line(centerX, centerY,x2,y2);    // seconds
  63.       pen.Color := clBlack;
  64.       Brush.color := clSilver;
  65.       EllipseC (centerX, centerY,3,3);
  66.       end;
  67. end;
  68.  
  69.  
  70.  


Must be adapted to NowUTC and the  belonging Timezone.

Have fun!

Winni
« Last Edit: August 08, 2020, 03:15:47 pm by winni »

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: UTC Time question
« Reply #54 on: August 08, 2020, 03:02:07 pm »

You should inform your gvernment.
They don't know about that:

https://info.australia.gov.au/about-australia/facts-and-figures/time-zones-and-daylight-saving

You would be surprised at what else they don't know !



Seriously, as you drive across there, you pass two big signs saying to adjust your clocks by, from memory, 45 minutes and then an hour and 15 minutes.  And probably not spoken to anyone in those time zones !

Right now, you cannot even drive across, the border is closed due to the virus !

I don't think JWest needs to allow for those particular time zones in his cals.  But there is a largish town / small city called Broken Hill in the far west of NSW that refuses to use NSW time and works to South Australian time. And it has an airport !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: UTC Time question
« Reply #55 on: August 08, 2020, 03:08:43 pm »

Seriously, as you drive across there, you pass two big signs saying to adjust your clocks by, from memory, 45 minutes and then an hour and 15 minutes.  And probably not spoken to anyone in those time zones !

Davo

Europe is too overcrowded!
Even in Northern Norway, the spanish Estremadura or on the tiny greek islands you won't find anything like that!

Winni

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: UTC Time question
« Reply #56 on: August 08, 2020, 03:12:37 pm »
IANAs allways up to date - but you have all the computing by yourself.

I am looking for a "ready to use" table.

If you get something off-the-shelf you'll have difficulty protecting your IP since you haven't added any value.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: UTC Time question
« Reply #57 on: August 08, 2020, 03:14:32 pm »
Hi!

IANAs allways up to date - but you have all the computing by yourself.

I am looking for a "ready to use" table.

Winni

What do you want in this table?
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

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: UTC Time question
« Reply #58 on: August 08, 2020, 03:23:36 pm »
IANAs allways up to date - but you have all the computing by yourself.

I am looking for a "ready to use" table.

If you get something off-the-shelf you'll have difficulty protecting your IP since you haven't added any value.


Are we really concerned about protecting the IP. I thought we would make one as a tutorial example of the Date and time functions. Post it on the form for anyone to use.

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: UTC Time question
« Reply #59 on: August 08, 2020, 03:44:07 pm »
Hi!

What we need is a table with countries and  their timezones and th daylight saving details - if there are: date and time of start, date and time of end.

There are strange rules like for EU:
Daylight saving starts: last Sunday in March, local time 2:00
Daylight saving end:  last Sunday in October, local time: 2:00

And such rules exist for a lot of different countries - so I'm looking for a table where this is already done.

For the timezones without daylight info I have a solution:

NaturalEarth https://www.naturalearthdata.com offers free vector data (polygons) for countries, rivers ... and for timeszones.
As your airport table contains latitude and logitude we can check with PointInPolygon to which zone a city belongs. But we have no info about daylight .

Winni

 

TinyPortal © 2005-2018