An example to call SetLocalTime Windows API from Tcl via Ffidl
package require Ffidl
ffidl::typedef SYSTEMTIME uint16 uint16 uint16 uint16 uint16 uint16 uint16 uint16
ffidl::callout SetLocalTime {pointer-var} int [::ffidl::symbol kernel32.dll SetLocalTime]
proc set_local_time {unixtime} {
set tcl_clock_fmts {%Y %m 0 %d %H %M %S 0}
set values [list]
foreach fmt $tcl_clock_fmts {
set v [clock format $unixtime -format $fmt]
lappend values [scan $v %d]
}
set systemtime [binary format [ffidl::info format SYSTEMTIME] {*}$values]
SetLocalTime systemtime
}