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

MI_Timestamp

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

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

フィールド

フィールドサイズx64x86説明
yearDWORD4+0+0年(西暦)。
monthDWORD4+4+4月(1〜12)。
dayDWORD4+8+8日(1〜31)。
hourDWORD4+12+12時(0〜23)。
minuteDWORD4+16+16分(0〜59)。
secondDWORD4+20+20秒(0〜59)。
microsecondsDWORD4+24+24マイクロ秒(0〜999999)。
utcINT4+28+28UTCからのオフセット(分)。符号付き整数。

各言語での定義

#include <windows.h>

// MI_Timestamp  (x64 32 / x86 32 バイト)
typedef struct MI_Timestamp {
    DWORD year;
    DWORD month;
    DWORD day;
    DWORD hour;
    DWORD minute;
    DWORD second;
    DWORD microseconds;
    INT utc;
} MI_Timestamp;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MI_Timestamp
{
    public uint year;
    public uint month;
    public uint day;
    public uint hour;
    public uint minute;
    public uint second;
    public uint microseconds;
    public int utc;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MI_Timestamp
    Public year As UInteger
    Public month As UInteger
    Public day As UInteger
    Public hour As UInteger
    Public minute As UInteger
    Public second As UInteger
    Public microseconds As UInteger
    Public utc As Integer
End Structure
import ctypes
from ctypes import wintypes

class MI_Timestamp(ctypes.Structure):
    _fields_ = [
        ("year", wintypes.DWORD),
        ("month", wintypes.DWORD),
        ("day", wintypes.DWORD),
        ("hour", wintypes.DWORD),
        ("minute", wintypes.DWORD),
        ("second", wintypes.DWORD),
        ("microseconds", wintypes.DWORD),
        ("utc", ctypes.c_int),
    ]
#[repr(C)]
pub struct MI_Timestamp {
    pub year: u32,
    pub month: u32,
    pub day: u32,
    pub hour: u32,
    pub minute: u32,
    pub second: u32,
    pub microseconds: u32,
    pub utc: i32,
}
import "golang.org/x/sys/windows"

type MI_Timestamp struct {
	year uint32
	month uint32
	day uint32
	hour uint32
	minute uint32
	second uint32
	microseconds uint32
	utc int32
}
type
  MI_Timestamp = record
    year: DWORD;
    month: DWORD;
    day: DWORD;
    hour: DWORD;
    minute: DWORD;
    second: DWORD;
    microseconds: DWORD;
    utc: Integer;
  end;
const MI_Timestamp = extern struct {
    year: u32,
    month: u32,
    day: u32,
    hour: u32,
    minute: u32,
    second: u32,
    microseconds: u32,
    utc: i32,
};
type
  MI_Timestamp {.bycopy.} = object
    year: uint32
    month: uint32
    day: uint32
    hour: uint32
    minute: uint32
    second: uint32
    microseconds: uint32
    utc: int32
struct MI_Timestamp
{
    uint year;
    uint month;
    uint day;
    uint hour;
    uint minute;
    uint second;
    uint microseconds;
    int utc;
}

HSP用 定義

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

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

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