Win32 API 日本語リファレンス
ホームSystem.Registry › DSKTLSYSTEMTIME

DSKTLSYSTEMTIME

構造体
サイズx64: 18 バイト / x86: 18 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
wYearWORD2+0+0年。西暦4桁で表す。
wMonthWORD2+2+2月を表す値。1〜12の範囲をとる。
wDayOfWeekWORD2+4+4曜日を表す値。0=日曜〜6=土曜。
wDayWORD2+6+6日を表す値。1〜31の範囲をとる。
wHourWORD2+8+8時を表す値。0〜23の範囲をとる。
wMinuteWORD2+10+10分を表す値。0〜59の範囲をとる。
wSecondWORD2+12+12秒を表す値。0〜59の範囲をとる。
wMillisecondsWORD2+14+14ミリ秒を表す値。0〜999の範囲をとる。
wResultWORD2+16+16操作結果を示す値。タイムゾーン変換の判定等に用いる。

各言語での定義

#include <windows.h>

// DSKTLSYSTEMTIME  (x64 18 / x86 18 バイト)
typedef struct DSKTLSYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
    WORD wResult;
} DSKTLSYSTEMTIME;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DSKTLSYSTEMTIME
{
    public ushort wYear;
    public ushort wMonth;
    public ushort wDayOfWeek;
    public ushort wDay;
    public ushort wHour;
    public ushort wMinute;
    public ushort wSecond;
    public ushort wMilliseconds;
    public ushort wResult;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DSKTLSYSTEMTIME
    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
    Public wResult As UShort
End Structure
import ctypes
from ctypes import wintypes

class DSKTLSYSTEMTIME(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),
        ("wResult", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct DSKTLSYSTEMTIME {
    pub wYear: u16,
    pub wMonth: u16,
    pub wDayOfWeek: u16,
    pub wDay: u16,
    pub wHour: u16,
    pub wMinute: u16,
    pub wSecond: u16,
    pub wMilliseconds: u16,
    pub wResult: u16,
}
import "golang.org/x/sys/windows"

type DSKTLSYSTEMTIME struct {
	wYear uint16
	wMonth uint16
	wDayOfWeek uint16
	wDay uint16
	wHour uint16
	wMinute uint16
	wSecond uint16
	wMilliseconds uint16
	wResult uint16
}
type
  DSKTLSYSTEMTIME = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
    wResult: Word;
  end;
const DSKTLSYSTEMTIME = extern struct {
    wYear: u16,
    wMonth: u16,
    wDayOfWeek: u16,
    wDay: u16,
    wHour: u16,
    wMinute: u16,
    wSecond: u16,
    wMilliseconds: u16,
    wResult: u16,
};
type
  DSKTLSYSTEMTIME {.bycopy.} = object
    wYear: uint16
    wMonth: uint16
    wDayOfWeek: uint16
    wDay: uint16
    wHour: uint16
    wMinute: uint16
    wSecond: uint16
    wMilliseconds: uint16
    wResult: uint16
struct DSKTLSYSTEMTIME
{
    ushort wYear;
    ushort wMonth;
    ushort wDayOfWeek;
    ushort wDay;
    ushort wHour;
    ushort wMinute;
    ushort wSecond;
    ushort wMilliseconds;
    ushort wResult;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DSKTLSYSTEMTIME サイズ: 18 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 18 / 4 切り上げ)
; wYear : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; wMonth : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; wDayOfWeek : WORD (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; wDay : WORD (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; wHour : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; wMinute : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; wSecond : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; wMilliseconds : WORD (+14, 2byte)  wpoke st,14,値  /  値 = wpeek(st,14)
; wResult : WORD (+16, 2byte)  wpoke st,16,値  /  値 = wpeek(st,16)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DSKTLSYSTEMTIME
    #field short wYear
    #field short wMonth
    #field short wDayOfWeek
    #field short wDay
    #field short wHour
    #field short wMinute
    #field short wSecond
    #field short wMilliseconds
    #field short wResult
#endstruct

stdim st, DSKTLSYSTEMTIME        ; NSTRUCT 変数を確保
st->wYear = 100
mes "wYear=" + st->wYear