ホーム › System.Search › SQL_DAY_SECOND_STRUCT
SQL_DAY_SECOND_STRUCT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| day | DWORD | 4 | +0 | +0 | 日数の値。日〜秒インターバルを表す。 |
| hour | DWORD | 4 | +4 | +4 | 時間数の値。 |
| minute | DWORD | 4 | +8 | +8 | 分数の値。 |
| second | DWORD | 4 | +12 | +12 | 秒数の値。 |
| fraction | DWORD | 4 | +16 | +16 | 秒の小数部。ナノ秒単位で格納する。 |
各言語での定義
#include <windows.h>
// SQL_DAY_SECOND_STRUCT (x64 20 / x86 20 バイト)
typedef struct SQL_DAY_SECOND_STRUCT {
DWORD day;
DWORD hour;
DWORD minute;
DWORD second;
DWORD fraction;
} SQL_DAY_SECOND_STRUCT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SQL_DAY_SECOND_STRUCT
{
public uint day;
public uint hour;
public uint minute;
public uint second;
public uint fraction;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SQL_DAY_SECOND_STRUCT
Public day As UInteger
Public hour As UInteger
Public minute As UInteger
Public second As UInteger
Public fraction As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SQL_DAY_SECOND_STRUCT(ctypes.Structure):
_fields_ = [
("day", wintypes.DWORD),
("hour", wintypes.DWORD),
("minute", wintypes.DWORD),
("second", wintypes.DWORD),
("fraction", wintypes.DWORD),
]#[repr(C)]
pub struct SQL_DAY_SECOND_STRUCT {
pub day: u32,
pub hour: u32,
pub minute: u32,
pub second: u32,
pub fraction: u32,
}import "golang.org/x/sys/windows"
type SQL_DAY_SECOND_STRUCT struct {
day uint32
hour uint32
minute uint32
second uint32
fraction uint32
}type
SQL_DAY_SECOND_STRUCT = record
day: DWORD;
hour: DWORD;
minute: DWORD;
second: DWORD;
fraction: DWORD;
end;const SQL_DAY_SECOND_STRUCT = extern struct {
day: u32,
hour: u32,
minute: u32,
second: u32,
fraction: u32,
};type
SQL_DAY_SECOND_STRUCT {.bycopy.} = object
day: uint32
hour: uint32
minute: uint32
second: uint32
fraction: uint32struct SQL_DAY_SECOND_STRUCT
{
uint day;
uint hour;
uint minute;
uint second;
uint fraction;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SQL_DAY_SECOND_STRUCT サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; day : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hour : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; minute : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; second : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; fraction : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SQL_DAY_SECOND_STRUCT
#field int day
#field int hour
#field int minute
#field int second
#field int fraction
#endstruct
stdim st, SQL_DAY_SECOND_STRUCT ; NSTRUCT 変数を確保
st->day = 100
mes "day=" + st->day