ホーム › System.Time › DYNAMIC_TIME_ZONE_INFORMATION
DYNAMIC_TIME_ZONE_INFORMATION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Bias | INT | 4 | +0 | +0 | UTCとローカル時刻の差(分)。ローカル時刻 = UTC + Biasの関係になる。 |
| StandardName | WCHAR | 64 | +4 | +4 | 標準時の名称を表すWCHAR配列(最大32文字)。 |
| StandardDate | SYSTEMTIME | 16 | +68 | +68 | 標準時へ切り替わる日時を表すSYSTEMTIME。 |
| StandardBias | INT | 4 | +84 | +84 | 標準時に追加で適用するバイアス(分)。通常0。 |
| DaylightName | WCHAR | 64 | +88 | +88 | 夏時間の名称を表すWCHAR配列(最大32文字)。 |
| DaylightDate | SYSTEMTIME | 16 | +152 | +152 | 夏時間へ切り替わる日時を表すSYSTEMTIME。 |
| DaylightBias | INT | 4 | +168 | +168 | 夏時間に追加で適用するバイアス(分)。通常-60。 |
| TimeZoneKeyName | WCHAR | 256 | +172 | +172 | レジストリのタイムゾーンキー名を表すWCHAR配列。動的DSTルール参照に使う。 |
| DynamicDaylightTimeDisabled | BOOLEAN | 1 | +428 | +428 | 動的な夏時間調整を無効化するか否かのフラグ。TRUEで無効。 |
各言語での定義
#include <windows.h>
// SYSTEMTIME (x64 16 / x86 16 バイト)
typedef struct SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
// DYNAMIC_TIME_ZONE_INFORMATION (x64 432 / x86 432 バイト)
typedef struct DYNAMIC_TIME_ZONE_INFORMATION {
INT Bias;
WCHAR StandardName[32];
SYSTEMTIME StandardDate;
INT StandardBias;
WCHAR DaylightName[32];
SYSTEMTIME DaylightDate;
INT DaylightBias;
WCHAR TimeZoneKeyName[128];
BOOLEAN DynamicDaylightTimeDisabled;
} DYNAMIC_TIME_ZONE_INFORMATION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SYSTEMTIME
{
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DYNAMIC_TIME_ZONE_INFORMATION
{
public int Bias;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string StandardName;
public SYSTEMTIME StandardDate;
public int StandardBias;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string DaylightName;
public SYSTEMTIME DaylightDate;
public int DaylightBias;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string TimeZoneKeyName;
[MarshalAs(UnmanagedType.U1)] public bool DynamicDaylightTimeDisabled;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SYSTEMTIME
Public wYear As UShort
Public wMonth As UShort
Public wDayOfWeek As UShort
Public wDay As UShort
Public wHour As UShort
Public wMinute As UShort
Public wSecond As UShort
Public wMilliseconds As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DYNAMIC_TIME_ZONE_INFORMATION
Public Bias As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public StandardName As String
Public StandardDate As SYSTEMTIME
Public StandardBias As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public DaylightName As String
Public DaylightDate As SYSTEMTIME
Public DaylightBias As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> Public TimeZoneKeyName As String
<MarshalAs(UnmanagedType.U1)> Public DynamicDaylightTimeDisabled As Boolean
End Structureimport ctypes
from ctypes import wintypes
class SYSTEMTIME(ctypes.Structure):
_fields_ = [
("wYear", ctypes.c_ushort),
("wMonth", ctypes.c_ushort),
("wDayOfWeek", ctypes.c_ushort),
("wDay", ctypes.c_ushort),
("wHour", ctypes.c_ushort),
("wMinute", ctypes.c_ushort),
("wSecond", ctypes.c_ushort),
("wMilliseconds", ctypes.c_ushort),
]
class DYNAMIC_TIME_ZONE_INFORMATION(ctypes.Structure):
_fields_ = [
("Bias", ctypes.c_int),
("StandardName", ctypes.c_wchar * 32),
("StandardDate", SYSTEMTIME),
("StandardBias", ctypes.c_int),
("DaylightName", ctypes.c_wchar * 32),
("DaylightDate", SYSTEMTIME),
("DaylightBias", ctypes.c_int),
("TimeZoneKeyName", ctypes.c_wchar * 128),
("DynamicDaylightTimeDisabled", ctypes.c_byte),
]#[repr(C)]
pub struct SYSTEMTIME {
pub wYear: u16,
pub wMonth: u16,
pub wDayOfWeek: u16,
pub wDay: u16,
pub wHour: u16,
pub wMinute: u16,
pub wSecond: u16,
pub wMilliseconds: u16,
}
#[repr(C)]
pub struct DYNAMIC_TIME_ZONE_INFORMATION {
pub Bias: i32,
pub StandardName: [u16; 32],
pub StandardDate: SYSTEMTIME,
pub StandardBias: i32,
pub DaylightName: [u16; 32],
pub DaylightDate: SYSTEMTIME,
pub DaylightBias: i32,
pub TimeZoneKeyName: [u16; 128],
pub DynamicDaylightTimeDisabled: u8,
}import "golang.org/x/sys/windows"
type SYSTEMTIME struct {
wYear uint16
wMonth uint16
wDayOfWeek uint16
wDay uint16
wHour uint16
wMinute uint16
wSecond uint16
wMilliseconds uint16
}
type DYNAMIC_TIME_ZONE_INFORMATION struct {
Bias int32
StandardName [32]uint16
StandardDate SYSTEMTIME
StandardBias int32
DaylightName [32]uint16
DaylightDate SYSTEMTIME
DaylightBias int32
TimeZoneKeyName [128]uint16
DynamicDaylightTimeDisabled byte
}type
SYSTEMTIME = record
wYear: Word;
wMonth: Word;
wDayOfWeek: Word;
wDay: Word;
wHour: Word;
wMinute: Word;
wSecond: Word;
wMilliseconds: Word;
end;
DYNAMIC_TIME_ZONE_INFORMATION = record
Bias: Integer;
StandardName: array[0..31] of WideChar;
StandardDate: SYSTEMTIME;
StandardBias: Integer;
DaylightName: array[0..31] of WideChar;
DaylightDate: SYSTEMTIME;
DaylightBias: Integer;
TimeZoneKeyName: array[0..127] of WideChar;
DynamicDaylightTimeDisabled: ByteBool;
end;const SYSTEMTIME = extern struct {
wYear: u16,
wMonth: u16,
wDayOfWeek: u16,
wDay: u16,
wHour: u16,
wMinute: u16,
wSecond: u16,
wMilliseconds: u16,
};
const DYNAMIC_TIME_ZONE_INFORMATION = extern struct {
Bias: i32,
StandardName: [32]u16,
StandardDate: SYSTEMTIME,
StandardBias: i32,
DaylightName: [32]u16,
DaylightDate: SYSTEMTIME,
DaylightBias: i32,
TimeZoneKeyName: [128]u16,
DynamicDaylightTimeDisabled: u8,
};type
SYSTEMTIME {.bycopy.} = object
wYear: uint16
wMonth: uint16
wDayOfWeek: uint16
wDay: uint16
wHour: uint16
wMinute: uint16
wSecond: uint16
wMilliseconds: uint16
DYNAMIC_TIME_ZONE_INFORMATION {.bycopy.} = object
Bias: int32
StandardName: array[32, uint16]
StandardDate: SYSTEMTIME
StandardBias: int32
DaylightName: array[32, uint16]
DaylightDate: SYSTEMTIME
DaylightBias: int32
TimeZoneKeyName: array[128, uint16]
DynamicDaylightTimeDisabled: uint8struct SYSTEMTIME
{
ushort wYear;
ushort wMonth;
ushort wDayOfWeek;
ushort wDay;
ushort wHour;
ushort wMinute;
ushort wSecond;
ushort wMilliseconds;
}
struct DYNAMIC_TIME_ZONE_INFORMATION
{
int Bias;
wchar[32] StandardName;
SYSTEMTIME StandardDate;
int StandardBias;
wchar[32] DaylightName;
SYSTEMTIME DaylightDate;
int DaylightBias;
wchar[128] TimeZoneKeyName;
ubyte DynamicDaylightTimeDisabled;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DYNAMIC_TIME_ZONE_INFORMATION サイズ: 432 バイト(x64)
dim st, 108 ; 4byte整数×108(構造体サイズ 432 / 4 切り上げ)
; Bias : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; StandardName : WCHAR (+4, 64byte) varptr(st)+4 を基点に操作(64byte:入れ子/配列)
; StandardDate : SYSTEMTIME (+68, 16byte) varptr(st)+68 を基点に操作(16byte:入れ子/配列)
; StandardBias : INT (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; DaylightName : WCHAR (+88, 64byte) varptr(st)+88 を基点に操作(64byte:入れ子/配列)
; DaylightDate : SYSTEMTIME (+152, 16byte) varptr(st)+152 を基点に操作(16byte:入れ子/配列)
; DaylightBias : INT (+168, 4byte) st.42 = 値 / 値 = st.42 (lpoke/lpeek も可)
; TimeZoneKeyName : WCHAR (+172, 256byte) varptr(st)+172 を基点に操作(256byte:入れ子/配列)
; DynamicDaylightTimeDisabled : BOOLEAN (+428, 1byte) poke st,428,値 / 値 = peek(st,428)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SYSTEMTIME
#field short wYear
#field short wMonth
#field short wDayOfWeek
#field short wDay
#field short wHour
#field short wMinute
#field short wSecond
#field short wMilliseconds
#endstruct
#defstruct global DYNAMIC_TIME_ZONE_INFORMATION
#field int Bias
#field wchar StandardName 32
#field SYSTEMTIME StandardDate
#field int StandardBias
#field wchar DaylightName 32
#field SYSTEMTIME DaylightDate
#field int DaylightBias
#field wchar TimeZoneKeyName 128
#field bool1 DynamicDaylightTimeDisabled
#endstruct
stdim st, DYNAMIC_TIME_ZONE_INFORMATION ; NSTRUCT 変数を確保
st->Bias = 100
mes "Bias=" + st->Bias