Dicas‎ > ‎

Horário de verão

Fonte: http://tudoecompanhia.blogspot.com/2008/10/ajustar-horrio-de-vero-no-linux.html

Ajustar horário de verão no linux


- Primeiro veja se existe no diretório /usr/share/zoneinfo/Brazil algum arquivo que contenha informações relativas a horário de verão (geralmente é um arquivo com extensão .zic).

- Se existir, copie o antigo e renomeie a cópia para 'verao.2008.zic', por exemplo. Se não existir, crie um novo, com o mesmo nome, no diretório citado acima. Este arquivo deve conter as seguintes linhas:

Rule Brazil 2008 only - Oct 19 00:00 1 S
Rule Brazil 2009 only - Feb 15 00:00 0 -

Zone Brazil/East -3:00 Brazil BR%sT

(Essas são as datas corretas para o horário de verão deste ano aqui no Brasil)

- Após isso, execute o comando 'zic':

# zic verao.2008.zic

- Para finalizar, deve-se copiar o arquivo East (que está na pasta /usr/share/zoneinfo/Brazil) para /etc/localtime

# cp East /etc/localtime

- Agora é só executar o comando:

# date

e o horário já deverá estar corrigido.


Script para linux

#!/bin/bash

rm -rf /etc/localtime

echo "Rule Brazil 2010 only - Feb 21 00:00 0 -" >  /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2010 only - Oct 17 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2011 only - Feb 20 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2011 only - Oct 16 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2012 only - Feb 26 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2012 only - Oct 21 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2013 only - Feb 17 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2013 only - Oct 20 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2014 only - Feb 16 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2014 only - Oct 19 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2015 only - Feb 22 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2015 only - Oct 18 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2016 only - Feb 21 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2016 only - Oct 16 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2017 only - Feb 19 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2017 only - Oct 15 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2018 only - Feb 18 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2018 only - Oct 21 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2019 only - Feb 17 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2019 only - Oct 20 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2020 only - Feb 16 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2020 only - Oct 18 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2021 only - Feb 21 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2021 only - Oct 17 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2022 only - Feb 20 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2022 only - Oct 16 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2023 only - Feb 19 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2023 only - Oct 15 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2024 only - Feb 18 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2024 only - Oct 20 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2025 only - Feb 16 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2025 only - Oct 19 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2026 only - Feb 15 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2026 only - Oct 18 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2027 only - Feb 21 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2027 only - Oct 17 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2028 only - Feb 20 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2028 only - Oct 15 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2029 only - Feb 18 00:00 0 -" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2029 only - Oct 21 00:00 1 S" >> /usr/share/zoneinfo/verao.zic
    echo "Rule Brazil 2030 only - Feb 17 00:00 0 -" >> /usr/share/zoneinfo/verao.zic

echo Zone Brazil/East -3:00 Brazil BR%sT >> /usr/share/zoneinfo/verao.zic

/usr/sbin/zic /usr/share/zoneinfo/verao.zic

cp /usr/share/zoneinfo/Brazil/East /etc/localtime

/usr/sbin/ntpdate pool.ntp.br

# conferindo alteracao
zdump -v /etc/localtime

# horario novo
date


Remover Horário de verão


#!/bin/bash

echo "Rule    BrazilSP  2004    only    -       Nov     02      0:00    1:00    S" >  /usr/share/zoneinfo/verao.zic
echo "Rule    BrazilSP  2005    only    -       Feb     20      0:00    0       -" >> /usr/share/zoneinfo/verao.zic
echo "# Zone  NAME                    GMTOFF  RULES/SAVE      FORMAT  [UNTIL]" >> /usr/share/zoneinfo/verao.zic
echo "Zone    America/Sao_Paulo       -3:00   BrazilSP        BR%sT" >> /usr/share/zoneinfo/verao.zic

/usr/sbin/zic /usr/share/zoneinfo/verao.zic

rm -rf /etc/localtime
cp /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime

/usr/sbin/ntpdate pool.ntp.br

# conferindo alteracao
zdump -v /etc/localtime

# horario novo
date

Ajustar Horário de verão no Windows

Fonte: http://time.pads.ufrj.br/

O programa para ajustar o horário de verão através do windows é o "ConfHV".

O programa para ajustar o horário de verão através do DOS é o "CmdHV".
Baixe o programa CmdHV e execute no DOS:

 CmdHV.exe /TZ:E. South America Standard Time /HI:2009-10-18 00:00:00 /HF:2010-02-21 00:00:00 /S:1


ċ
CmdHV.zip
(16k)
Silvio Garbes,
19 de out de 2009 04:23
ċ
ConfHV.zip
(23k)
Silvio Garbes,
19 de out de 2009 04:23
Comments