Compartilhar via


Daylight Saving Time Registry Settings

Windows Mobile Not SupportedWindows Embedded CE Supported

9/8/2008

O seguinte exemplo chave do Registro mostra como definir o sistema operacional para horário de verão durante frio ou inicialização a quente.

[HKEY_LOCAL_MACHINE\Software\Microsoft\Clock]
   "HomeDST": REG_DWORD

Se você definir esse valor do Registro para 1, horário de verão será habilitado para o atual zona de tempo quando o OS é inicializado. O OS lê o atual zona de tempo quando o OS é inicializado. Se você definir esse valor do Registro como 0, horário de verão será desabilitado o próximo tempo inicializa o OS. O OS lê este valor do Registro apenas quando o OS é inicializado. Se o OS Não é possível localizar este valor do Registro, o OS usa o valor usar como padrão de 0.

Para Windows Embedded CE, o chave do Registro para horário de verão não é Por padrão presente. Não há nenhum auto-ajustável para horário de verão. A chave Registro é criado por demanda, de exemplo, quando o aplicativo relógio está ativado. Se a chave estiver presente, o valor da chave Registro deve ser usado como está, para a lógica .NET Compact Framework ao trabalho, that is, para DateTime.Now Para retornar um valor coerente.

Observação

Você pode usar a função SetDaylightTime para habilitar ou desativar horário de verão em codificar.

Ramificações de funcionar política de energia

Em 8 de agosto de 2005, o ACT política energia foi assinado em lei para estender horário de verão por aproximadamente Four Weeks. Iniciar na primavera de 2007, o data de início é três semanas anteriores (2: 00 A.M. No segundo domingo de março de), e a data final é uma semana mais tarde (2: 00 A.M. No primeiro domingo de novembro de).

O seguinte tempo zonas são afetadas:

  • (GMT-03: 30). Terra Nova
  • (GMT-04: 00) Hora do Atlântico (Canadá)
  • (GMT-05: 00) Hora do leste dos EUA (US & No Canadá)
  • (GMT-06: 00) Hora Central (EUA & No Canadá)
  • (GMT-07: 00) Hora das Montanhas (EUA & No Canadá)
  • (GMT-08: 00) Hora do Pacífico (EUA & No Canadá)
  • (GMT-09: 00) Alasca

Microsoft atualizados os dados horário de verão para refletir o novo iniciar e end datas e horas.

Configurações do Registro ACT política Pre-Energy

O padrão zona de tempo nome corresponde ao StandardName membro da estrutura TIME_ZONE_INFORMATION, portanto, a mesma regras e condições que aplicar para aplicar a estrutura para essa chave Registro.

Os dados zona de tempo podem ser encontrados no seguinte arquivo: %_WINCEROOT%\Public\Common\OAK\Files\common.reg

Observação

Somente a linha de dados que começam com "TZI" = precisa ser modificado.Não modifique as linhas que começam com "Exibir" =, "DLT" =, e "padrão" = Como eles devem corresponder ao arquivo de recurso.

[HKEY_LOCAL_MACHINE\Time Zones\Newfoundland Standard Time]
   "Display"=mui_sz:"coredll.dll,#32788"
   "Dlt"=mui_sz:"coredll.dll,#33044"
   "Std"=mui_sz:"coredll.dll,#33300"
   "TZI"=hex:d2,00,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0a,00,00,00,05,00,02,00,00,00,00,00,00,00,\
      00,00,04,00,00,00,01,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Atlantic Standard Time]
   "Display"=mui_sz:"coredll.dll,#32783"
   "Dlt"=mui_sz:"coredll.dll,#33039"
   "Std"=mui_sz:"coredll.dll,#33295"
   "TZI"=hex:f0,00,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0a,00,00,00,05,00,02,00,00,00,00,00,00,00,\
      00,00,04,00,00,00,01,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Eastern Standard Time]
   "Display"=mui_sz:"coredll.dll,#32780"
   "Dlt"=mui_sz:"coredll.dll,#33036"
   "Std"=mui_sz:"coredll.dll,#33292"
   "TZI"=hex:2c,01,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0a,00,00,00,05,00,02,00,00,00,00,00,00,00,\
      00,00,04,00,00,00,01,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Central Standard Time]
   "Display"=mui_sz:"coredll.dll,#32776"
   "Dlt"=mui_sz:"coredll.dll,#33032"
   "Std"=mui_sz:"coredll.dll,#33288"
   "TZI"=hex:68,01,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0a,00,00,00,05,00,02,00,00,00,00,00,00,00,\
      00,00,04,00,00,00,01,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Mountain Standard Time]
   "Display"=mui_sz:"coredll.dll,#32773"
   "Dlt"=mui_sz:"coredll.dll,#33029"
   "Std"=mui_sz:"coredll.dll,#33285"
   "TZI"=hex:a4,01,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0a,00,00,00,05,00,02,00,00,00,00,00,00,00,\
      00,00,04,00,00,00,01,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Pacific Standard Time]
   "Display"=mui_sz:"coredll.dll,#32772"
   "Dlt"=mui_sz:"coredll.dll,#33028"
   "Std"=mui_sz:"coredll.dll,#33284"
   "TZI"=hex:e0,01,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0a,00,00,00,05,00,02,00,00,00,00,00,00,00,\
      00,00,04,00,00,00,01,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Alaskan Standard Time]
   "Display"=mui_sz:"coredll.dll,#32771"
   "Dlt"=mui_sz:"coredll.dll,#33027"
   "Std"=mui_sz:"coredll.dll,#33283"
   "TZI"=hex:1c,02,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0a,00,00,00,05,00,02,00,00,00,00,00,00,00,\
      00,00,04,00,00,00,01,00,02,00,00,00,00,00,00,00

Configurações do Registro ACT política Post-Energy

O seguinte configurações Registro estão usar como padrão para CE 6.0.

Observação

Somente a linha de dados que começam com "TZI" = precisa ser modificado.Não modifique as linhas que começam com "Exibir" =, "DLT" =, e "padrão" = Como eles devem corresponder ao arquivo de recurso.

[HKEY_LOCAL_MACHINE\Time Zones\Newfoundland Standard Time]
   "Display"=mui_sz:"coredll.dll,#32788"
   "Dlt"=mui_sz:"coredll.dll,#33044"
   "Std"=mui_sz:"coredll.dll,#33300"
   "TZI"=hex:d2,00,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0b,00,00,00,01,00,02,00,00,00,00,00,00,00,\
      00,00,03,00,00,00,02,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Atlantic Standard Time]
   "Display"=mui_sz:"coredll.dll,#32783"
   "Dlt"=mui_sz:"coredll.dll,#33039"
   "Std"=mui_sz:"coredll.dll,#33295"
   "TZI"=hex:f0,00,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0b,00,00,00,01,00,02,00,00,00,00,00,00,00,\
      00,00,03,00,00,00,02,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Eastern Standard Time]
   "Display"=mui_sz:"coredll.dll,#32780"
   "Dlt"=mui_sz:"coredll.dll,#33036"
   "Std"=mui_sz:"coredll.dll,#33292"
   "TZI"=hex:2c,01,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0b,00,00,00,01,00,02,00,00,00,00,00,00,00,\
      00,00,03,00,00,00,02,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Central Standard Time]
   "Display"=mui_sz:"coredll.dll,#32776"
   "Dlt"=mui_sz:"coredll.dll,#33032"
   "Std"=mui_sz:"coredll.dll,#33288"
   "TZI"=hex:68,01,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0b,00,00,00,01,00,02,00,00,00,00,00,00,00,\
      00,00,03,00,00,00,02,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Mountain Standard Time]
   "Display"=mui_sz:"coredll.dll,#32773"
   "Dlt"=mui_sz:"coredll.dll,#33029"
   "Std"=mui_sz:"coredll.dll,#33285"
   "TZI"=hex:a4,01,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0b,00,00,00,01,00,02,00,00,00,00,00,00,00,\
      00,00,03,00,00,00,02,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Pacific Standard Time]
   "Display"=mui_sz:"coredll.dll,#32772"
   "Dlt"=mui_sz:"coredll.dll,#33028"
   "Std"=mui_sz:"coredll.dll,#33284"
   "TZI"=hex:e0,01,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0b,00,00,00,01,00,02,00,00,00,00,00,00,00,\
      00,00,03,00,00,00,02,00,02,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Time Zones\Alaskan Standard Time]
   "Display"=mui_sz:"coredll.dll,#32771"
   "Dlt"=mui_sz:"coredll.dll,#33027"
   "Std"=mui_sz:"coredll.dll,#33283"
   "TZI"=hex:1c,02,00,00,00,00,00,00,c4,ff,ff,ff,\
      00,00,0b,00,00,00,01,00,02,00,00,00,00,00,00,00,\
      00,00,03,00,00,00,02,00,02,00,00,00,00,00,00,00

Código de exemplo para atualizar o registro

O seguinte exemplo codificar verifica o atual data e quando é 1 de janeiro de 2007, executa a modificação Registro para a nova configuração. Hora oficial Atlântico é usada como um exemplo.

#include <windows.h>
// New value for Atlantic Standard Time
BYTE bNewVal[44] = {0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc4,0xff,0xff,0xff,0x00,0x00,0x0b,0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00
} ;
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd )
{
   HKEY hKey;
   LONG retCode;
   BYTE bVal[44];
   DWORD dwType = REG_BINARY;
   DWORD dwSize = sizeof(bVal);
   SYSTEMTIME st;
   GetSystemTime(&st);
   // This check updates the registry whenever this code runs starting January 1, 2007.
   if(st.wYear > 2006){
      if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Time Zones\\Atlantic Standard Time", 0, 0, &hKey)){
      if ((ERROR_SUCCESS == RegQueryValueEx(hKey, L"TZI", NULL, &dwType, (BYTE*) &bVal, &dwSize)) && (dwType == REG_BINARY))
         {
         // Check registry value to see if old value.
         // This check needs to be changed depending on time zone being updated.
         if(bVal[30] == 0x04)
            {
               retCode = RegSetValueEx(hKey, L"TZI", 0, REG_BINARY, (BYTE*) &bNewVal, sizeof(bNewVal));
               if(ERROR_SUCCESS != retCode)
               NKDbgPrintfW (_T("Failed to write to registry...\r\n"));
            }
         }
      }
   }
   if(hKey){
      RegFlushKey(hKey);
      RegCloseKey(hKey);
   }
   return 0;
}
// If you have the automatic DST service (timesvc.dll) included in your image, you must update it after changing the timezone information in the regsitry.  The following source code will perform this:
extern "C" void RefreshTimeSvc()
{
   HANDLE hFile;
   hFile = CreateFile(L"NTP0:",GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
   if (INVALID_HANDLE_VALUE == hFile)
      return;
   DeviceIoControl(hFile,IOCTL_SERVICE_REFRESH,0,0,0,0,NULL,0);
   CloseHandle(hFile);
}

See Also

Reference

TIME_ZONE_INFORMATION

Concepts

Time Zone Registry Settings

Other Resources

Core OS Registry Settings
Kernel Migration