Brazil changes - new "perennial" DST rules

Frederico A C Neves fneves at registro.br
Wed Sep 10 15:18:53 UTC 2008


Acording to this decree

http://www.planalto.gov.br/ccivil_03/_Ato2007-2010/2008/Decreto/D6558.htm

The DST period in Brazil now on will be from the 3rd Oct Sunday to the
3rd Feb Sunday. There is an exception on the return date when this is
the Carnival Sunday then the return date will be the next Sunday.

Attached proposed diffs for the current Southamerica file and a script
to calculate the exceptions.

Regards,
Frederico Neves

-------------- next part --------------
--- southamerica-orig	2008-09-10 11:10:49.000000000 -0300
+++ southamerica	2008-09-10 11:46:29.000000000 -0300
@@ -724,10 +724,21 @@
 Rule	Brazil	2007	only	-	Feb	25	 0:00	0	-
 # Decree <a href="http://pcdsh01.on.br/DecHV6212.gif">6,212</a> (2007-09-26),
 # adopted by the same states as before.
-Rule	Brazil	2007	max	-	Oct	Sun>=8	 0:00	1:00	S
+Rule	Brazil	2007	only	-	Oct	Sun>=8	 0:00	1:00	S
 Rule	Brazil	2008	max	-	Feb	Sun>=15	 0:00	0	-
-# The latest ruleset listed above says that the following states observe DST:
-# DF, ES, GO, MG, MS, MT, PR, RJ, RS, SC, SP.
+# Decree <a href="http://www.planalto.gov.br/ccivil_03/_Ato2007-2010/2008/Decreto/D6558.htm">6,558</a>
+# At least a fixed rule! 3rd Sun Oct to 3rd Sun Feb. There is an
+# exceptiion when the return date is a Carnival Sunday then the return
+# will be the next Sunday. Exceptions until 2038 calculated bellow
+# adopted by the same states as before.
+Rule	Brazil	2008	max	-	Oct	Sun>=15	 0:00	1:00	S
+Rule	Brazil	2012	only	-	Feb	26	 0:00	0	-
+Rule	Brazil	2015	only	-	Feb	22	 0:00	0	-
+Rule	Brazil	2023	only	-	Feb	26	 0:00	0	-
+Rule	Brazil	2026	only	-	Feb	22	 0:00	0	-
+Rule	Brazil	2034	only	-	Feb	26	 0:00	0	-
+Rule	Brazil	2037	only	-	Feb	22	 0:00	0	-
+
 # For dates after mid-2008, the above rules with TO="max" are guesses
 # and are quite possibly wrong, but are more likely than no DST at all.
 
-------------- next part --------------
#! /usr/bin/python
import datetime

def ThirdSunFeb(year):
    d1 = datetime.date(year,2,1)
    diff = 14
    if d1.weekday() != 6:
        diff = 6 - d1.weekday() + 14
    return d1 + datetime.timedelta(diff)

print "Easter     Carnival   Retdst"
for a in range(2009,2039):
    # Easter Calculation
    # "Gabriel Zucco Tau" <gabrieltau at gabrieltau.com.br>
    # J.-M.Oudin (1940) 
    # "Explanatory Supplement to the Astronomical Almanac, ed. P.K. Seidelmann (1992)"
    c = a/100
    n = a - 19*(a/19)
    k = (c - 17)/25
    i = c - c/4 - (c-k)/3 +19*n + 15
    i = i - 30*(i/30)
    i = i - (i/28)*(1-(1/28)*(29/(i+1))*((21-n)/11))
    j = a + a/4 + i + 2 - c + c/4
    j = j - 7*(j/7)
    l = i - j
    m = 3 + (l+40)/44
    d = l + 28 - 31*(m/4)
    easter = datetime.date(a,m,d)
    # Carnival Sunday is seven weeks before easter
    carnival = easter - datetime.timedelta(7*7)
    tsf = ThirdSunFeb(a)
    retdst = tsf

    if tsf == carnival:
        # Exception add a week 
        retdst = tsf + datetime.timedelta(7)
        print easter, carnival, retdst, "*"
    else:
        print easter, carnival, retdst


More information about the tz mailing list