Win32 API 日本語リファレンス
ホームDevices.WebServicesOnDevices › WSD_DATETIME

WSD_DATETIME

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

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

フィールド

フィールドサイズx64x86説明
isPositiveBOOL4+0+0year の値が正の場合は TRUE です。
yearDWORD4+4+4年の値 (例: 2005)。この数値は 0 から max(ULONG) までの値です。
monthBYTE1+8+81 から始まる月の値 (1 = 1 月 ~ 12 = 12 月)。
dayBYTE1+9+91 から始まる月内の日の値 (1 ~ 31)。
hourBYTE1+10+100 から始まる時の値 (0 ~ 23)。hour=24 は、minutesecond の両方が 0 の場合にのみ許可されます。
minuteBYTE1+11+110 から始まる分の値 (0 ~ 59)。
secondBYTE1+12+120 から始まる秒の値 (0 ~ 59)。
millisecondDWORD4+16+16ミリ秒の値 (0 ~ 999)。この構造体が XML に変換されると、ミリ秒の値は秒の小数部として 10 進形式で表現されます。たとえば、millisecond の値が 9 の場合、XML の出力は 0.009 になります。
TZIsLocalBOOL4+20+20日付と時刻がローカルタイムゾーンに基づく場合は TRUE、UTC + オフセットの場合は FALSE です。
TZIsPositiveBOOL4+24+24TZHourTZMinute で指定されるタイムゾーンオフセットが UTC に対して正の場合は TRUE、負の場合は FALSE です。TZIsLocalTRUE の場合は有効ではありません。
TZHourBYTE1+28+28UTC に対するタイムゾーンオフセット (0 ~ 13)。TZMinute が 0 の場合は TZhour=14 も許可されます。TZIsLocalTRUE の場合は有効ではありません。
TZMinuteBYTE1+29+29UTC に対するタイムゾーンオフセット (0 ~ 59)。TZIsLocalTRUE の場合は有効ではありません。

公式ドキュメント

タイムスタンプを表します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// WSD_DATETIME  (x64 32 / x86 32 バイト)
typedef struct WSD_DATETIME {
    BOOL isPositive;
    DWORD year;
    BYTE month;
    BYTE day;
    BYTE hour;
    BYTE minute;
    BYTE second;
    DWORD millisecond;
    BOOL TZIsLocal;
    BOOL TZIsPositive;
    BYTE TZHour;
    BYTE TZMinute;
} WSD_DATETIME;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WSD_DATETIME
{
    [MarshalAs(UnmanagedType.Bool)] public bool isPositive;
    public uint year;
    public byte month;
    public byte day;
    public byte hour;
    public byte minute;
    public byte second;
    public uint millisecond;
    [MarshalAs(UnmanagedType.Bool)] public bool TZIsLocal;
    [MarshalAs(UnmanagedType.Bool)] public bool TZIsPositive;
    public byte TZHour;
    public byte TZMinute;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WSD_DATETIME
    <MarshalAs(UnmanagedType.Bool)> Public isPositive As Boolean
    Public year As UInteger
    Public month As Byte
    Public day As Byte
    Public hour As Byte
    Public minute As Byte
    Public second As Byte
    Public millisecond As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public TZIsLocal As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public TZIsPositive As Boolean
    Public TZHour As Byte
    Public TZMinute As Byte
End Structure
import ctypes
from ctypes import wintypes

class WSD_DATETIME(ctypes.Structure):
    _fields_ = [
        ("isPositive", wintypes.BOOL),
        ("year", wintypes.DWORD),
        ("month", ctypes.c_ubyte),
        ("day", ctypes.c_ubyte),
        ("hour", ctypes.c_ubyte),
        ("minute", ctypes.c_ubyte),
        ("second", ctypes.c_ubyte),
        ("millisecond", wintypes.DWORD),
        ("TZIsLocal", wintypes.BOOL),
        ("TZIsPositive", wintypes.BOOL),
        ("TZHour", ctypes.c_ubyte),
        ("TZMinute", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct WSD_DATETIME {
    pub isPositive: i32,
    pub year: u32,
    pub month: u8,
    pub day: u8,
    pub hour: u8,
    pub minute: u8,
    pub second: u8,
    pub millisecond: u32,
    pub TZIsLocal: i32,
    pub TZIsPositive: i32,
    pub TZHour: u8,
    pub TZMinute: u8,
}
import "golang.org/x/sys/windows"

type WSD_DATETIME struct {
	isPositive int32
	year uint32
	month byte
	day byte
	hour byte
	minute byte
	second byte
	millisecond uint32
	TZIsLocal int32
	TZIsPositive int32
	TZHour byte
	TZMinute byte
}
type
  WSD_DATETIME = record
    isPositive: BOOL;
    year: DWORD;
    month: Byte;
    day: Byte;
    hour: Byte;
    minute: Byte;
    second: Byte;
    millisecond: DWORD;
    TZIsLocal: BOOL;
    TZIsPositive: BOOL;
    TZHour: Byte;
    TZMinute: Byte;
  end;
const WSD_DATETIME = extern struct {
    isPositive: i32,
    year: u32,
    month: u8,
    day: u8,
    hour: u8,
    minute: u8,
    second: u8,
    millisecond: u32,
    TZIsLocal: i32,
    TZIsPositive: i32,
    TZHour: u8,
    TZMinute: u8,
};
type
  WSD_DATETIME {.bycopy.} = object
    isPositive: int32
    year: uint32
    month: uint8
    day: uint8
    hour: uint8
    minute: uint8
    second: uint8
    millisecond: uint32
    TZIsLocal: int32
    TZIsPositive: int32
    TZHour: uint8
    TZMinute: uint8
struct WSD_DATETIME
{
    int isPositive;
    uint year;
    ubyte month;
    ubyte day;
    ubyte hour;
    ubyte minute;
    ubyte second;
    uint millisecond;
    int TZIsLocal;
    int TZIsPositive;
    ubyte TZHour;
    ubyte TZMinute;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WSD_DATETIME サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; isPositive : BOOL (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; year : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; month : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; day : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; hour : BYTE (+10, 1byte)  poke st,10,値  /  値 = peek(st,10)
; minute : BYTE (+11, 1byte)  poke st,11,値  /  値 = peek(st,11)
; second : BYTE (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; millisecond : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; TZIsLocal : BOOL (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; TZIsPositive : BOOL (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; TZHour : BYTE (+28, 1byte)  poke st,28,値  /  値 = peek(st,28)
; TZMinute : BYTE (+29, 1byte)  poke st,29,値  /  値 = peek(st,29)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WSD_DATETIME
    #field bool isPositive
    #field int year
    #field byte month
    #field byte day
    #field byte hour
    #field byte minute
    #field byte second
    #field int millisecond
    #field bool TZIsLocal
    #field bool TZIsPositive
    #field byte TZHour
    #field byte TZMinute
#endstruct

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