ホーム › Devices.WebServicesOnDevices › WSD_DATETIME
WSD_DATETIME
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| isPositive | BOOL | 4 | +0 | +0 | 日時が正(西暦正方向)か否かを示すフラグ。 |
| year | DWORD | 4 | +4 | +4 | 年。 |
| month | BYTE | 1 | +8 | +8 | 月(1〜12)。 |
| day | BYTE | 1 | +9 | +9 | 日(1〜31)。 |
| hour | BYTE | 1 | +10 | +10 | 時(0〜23)。 |
| minute | BYTE | 1 | +11 | +11 | 分(0〜59)。 |
| second | BYTE | 1 | +12 | +12 | 秒(0〜59)。 |
| millisecond | DWORD | 4 | +16 | +16 | ミリ秒。 |
| TZIsLocal | BOOL | 4 | +20 | +20 | タイムゾーンがローカルか否かのフラグ。 |
| TZIsPositive | BOOL | 4 | +24 | +24 | タイムゾーンオフセットが正方向か否かのフラグ。 |
| TZHour | BYTE | 1 | +28 | +28 | タイムゾーンオフセットの時部分。 |
| TZMinute | BYTE | 1 | +29 | +29 | タイムゾーンオフセットの分部分。 |
各言語での定義
#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 Structureimport 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: uint8struct 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