ホーム › System.Power › ACPI_REAL_TIME
ACPI_REAL_TIME
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Year | WORD | 2 | +0 | +0 | ACPIリアルタイムクロックの年。西暦4桁で表す。 |
| Month | BYTE | 1 | +2 | +2 | 月を表す値。1〜12の範囲をとる。 |
| Day | BYTE | 1 | +3 | +3 | 日を表す値。1〜31の範囲をとる。 |
| Hour | BYTE | 1 | +4 | +4 | 時を表す値。0〜23の範囲をとる。 |
| Minute | BYTE | 1 | +5 | +5 | 分を表す値。0〜59の範囲をとる。 |
| Second | BYTE | 1 | +6 | +6 | 秒を表す値。0〜59の範囲をとる。 |
| Valid | BYTE | 1 | +7 | +7 | この時刻情報が有効かどうかを示すフラグ。0で無効。 |
| Milliseconds | WORD | 2 | +8 | +8 | ミリ秒を表す値。0〜999の範囲をとる。 |
| TimeZone | SHORT | 2 | +10 | +10 | タイムゾーンのUTCからのオフセット。分単位の符号付き値。 |
| DayLight | BYTE | 1 | +12 | +12 | 夏時間(DST)の状態を示すフラグ。 |
| Reserved1 | BYTE | 3 | +13 | +13 | 将来の拡張用に予約された領域。0を設定する。 |
各言語での定義
#include <windows.h>
// ACPI_REAL_TIME (x64 16 / x86 16 バイト)
typedef struct ACPI_REAL_TIME {
WORD Year;
BYTE Month;
BYTE Day;
BYTE Hour;
BYTE Minute;
BYTE Second;
BYTE Valid;
WORD Milliseconds;
SHORT TimeZone;
BYTE DayLight;
BYTE Reserved1[3];
} ACPI_REAL_TIME;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ACPI_REAL_TIME
{
public ushort Year;
public byte Month;
public byte Day;
public byte Hour;
public byte Minute;
public byte Second;
public byte Valid;
public ushort Milliseconds;
public short TimeZone;
public byte DayLight;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Reserved1;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ACPI_REAL_TIME
Public Year As UShort
Public Month As Byte
Public Day As Byte
Public Hour As Byte
Public Minute As Byte
Public Second As Byte
Public Valid As Byte
Public Milliseconds As UShort
Public TimeZone As Short
Public DayLight As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved1() As Byte
End Structureimport ctypes
from ctypes import wintypes
class ACPI_REAL_TIME(ctypes.Structure):
_fields_ = [
("Year", ctypes.c_ushort),
("Month", ctypes.c_ubyte),
("Day", ctypes.c_ubyte),
("Hour", ctypes.c_ubyte),
("Minute", ctypes.c_ubyte),
("Second", ctypes.c_ubyte),
("Valid", ctypes.c_ubyte),
("Milliseconds", ctypes.c_ushort),
("TimeZone", ctypes.c_short),
("DayLight", ctypes.c_ubyte),
("Reserved1", ctypes.c_ubyte * 3),
]#[repr(C)]
pub struct ACPI_REAL_TIME {
pub Year: u16,
pub Month: u8,
pub Day: u8,
pub Hour: u8,
pub Minute: u8,
pub Second: u8,
pub Valid: u8,
pub Milliseconds: u16,
pub TimeZone: i16,
pub DayLight: u8,
pub Reserved1: [u8; 3],
}import "golang.org/x/sys/windows"
type ACPI_REAL_TIME struct {
Year uint16
Month byte
Day byte
Hour byte
Minute byte
Second byte
Valid byte
Milliseconds uint16
TimeZone int16
DayLight byte
Reserved1 [3]byte
}type
ACPI_REAL_TIME = record
Year: Word;
Month: Byte;
Day: Byte;
Hour: Byte;
Minute: Byte;
Second: Byte;
Valid: Byte;
Milliseconds: Word;
TimeZone: Smallint;
DayLight: Byte;
Reserved1: array[0..2] of Byte;
end;const ACPI_REAL_TIME = extern struct {
Year: u16,
Month: u8,
Day: u8,
Hour: u8,
Minute: u8,
Second: u8,
Valid: u8,
Milliseconds: u16,
TimeZone: i16,
DayLight: u8,
Reserved1: [3]u8,
};type
ACPI_REAL_TIME {.bycopy.} = object
Year: uint16
Month: uint8
Day: uint8
Hour: uint8
Minute: uint8
Second: uint8
Valid: uint8
Milliseconds: uint16
TimeZone: int16
DayLight: uint8
Reserved1: array[3, uint8]struct ACPI_REAL_TIME
{
ushort Year;
ubyte Month;
ubyte Day;
ubyte Hour;
ubyte Minute;
ubyte Second;
ubyte Valid;
ushort Milliseconds;
short TimeZone;
ubyte DayLight;
ubyte[3] Reserved1;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ACPI_REAL_TIME サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Year : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; Month : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; Day : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; Hour : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; Minute : BYTE (+5, 1byte) poke st,5,値 / 値 = peek(st,5)
; Second : BYTE (+6, 1byte) poke st,6,値 / 値 = peek(st,6)
; Valid : BYTE (+7, 1byte) poke st,7,値 / 値 = peek(st,7)
; Milliseconds : WORD (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; TimeZone : SHORT (+10, 2byte) wpoke st,10,値 / 値 = wpeek(st,10)
; DayLight : BYTE (+12, 1byte) poke st,12,値 / 値 = peek(st,12)
; Reserved1 : BYTE (+13, 3byte) varptr(st)+13 を基点に操作(3byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ACPI_REAL_TIME
#field short Year
#field byte Month
#field byte Day
#field byte Hour
#field byte Minute
#field byte Second
#field byte Valid
#field short Milliseconds
#field short TimeZone
#field byte DayLight
#field byte Reserved1 3
#endstruct
stdim st, ACPI_REAL_TIME ; NSTRUCT 変数を確保
st->Year = 100
mes "Year=" + st->Year