[elektro] GPS óra

Pipi lista at puzsar.hu
Tue Aug 2 17:30:51 CEST 2011


2011.08.02. 13:55 keltezéssel, Ökrös Miklós írta:
> Ha esetleg tudsz algoritmust, megkímélnél a googlizástól (és a kételytől,
> hogy jó-e, amit találtam)!

elenőrzésképp :) (már a weboldal nem úgy megy ahonnan van http://www.webexhibits.org/daylightsaving/b.html)
		United States 			 	European Union
---------------------------------------------------------------------------------------------------
  Year  DST Begins 	DST Ends		Summertime 	Summertime
	at 2 a.m.	at 2 a.m.			period begins	period ends
---------------------------------------------------------------------------------------------------
				at 1 a.m. UT	at 1 a.m. UT
---------------------------------------------------------------------------------------------------
2001	April  1	October 28		March 25	October 28
2002	April  7	October 27		March 31	October 27
2003	April  6	October 26		March 30	October 26
2004	April  4	October 31		March 28	October 31
2005	April  3	October 30		March 27	October 30
2006	April  2	October 29		March 26	October 29
2007	March 11	November 4		March 25	October 28
2008	March  9	November 2		March 30	October 26
2009	March  8	November 1		March 29	October 25
2010	March 14	November 7		March 28	October 31
2011	March 13	November 6		March 27	October 30
2012	March 11	November 4		March 25	October 28
2013	March 10	November 3		March 31	October 27
2014	March 10	November 3		March 31	October 27
2015	March  8	November 1		March 29	October 25
2016	March 13	November 6		March 27	October 30
2017	March 12	November 5		March 26	October 29
2018	March 11	November 4		March 25	October 28

http://www.webexhibits.org/daylightsaving/i.html
You can use the following equations to calculate when DST starts and ends. The divisions are integer divisions, in which remainders are discarded. "mod" means the remainder when doing integer 
division, e.g., 20 mod 7 = 6. That is, 20 divided by 7 is 2 and 6/7th (where six is the remainder). With: y = year.

For the United States:
	Begin DST: Sunday April (2+6*y-y/4) mod 7+1
	End DST: Sunday October (31-(y*5/4+1) mod 7)
	Valid for years 1900 to 2006, though DST wasn't adopted until the 1950s-1960s. 2007 and after:
	Begin DST: Sunday March 14 - (1 + y*5/4) mod 7
	End DST: Sunday November 7 - (1 + y*5/4) mod 7;


European Economic Community:
	Begin DST: Sunday March (31 - (5*y/4 + 4) mod 7) at 1h U.T.
	End DST: Sunday October (31 - (5*y/4 + 1) mod 7) at 1h U.T.
	Since 1996, valid through 2099


--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
  http://www.nondirectionaltrading.com/daylight-saving-time.htm
  Year  DST Begins
   Summertime	Summertime
period begins	period ends
at 1 a.m. UT		at 1 a.m. UT
2008	 March 30	October 26
2009	 March 29	October 25
2010	 March 28	October 31
2011	 March 27	October 30
2012	 March 25	October 28
2013	 March 31      	October 27
--------------------------------------------------------------------------------
US calculator valid 1976-2099; EU 1996-2099. Change with up/down key.

szerintem a legegyszerűbb ha az x idő (pl Reference Epoch to use.  (default: 01-Jan-1970 00:00:00))

  óta eltelt másodpercekkel számolsz,
  igy könnyű hozzáadni a timezónát és ha kell a téli/nyári eltolást,
C konyvtári függvény meg van ami ebből kiszámolja a dátumot, órát, percet

-- 
Pipi
http://www.puzsar.hu



More information about the Elektro mailing list