Порівняти коміти

..
Автор SHA1 Повідомлення Дата
l0ng-ai 54e3b63547 fix(themes): add the shell command token to the theme template and docs
#3458 added --syn-shell-command without setting it in the Harbor Night
scheme (the template new themes start from) or regenerating plugins/themes.md,
so scripts/theme/theme.test.ts failed. Imported IntelliJ schemes map
BASH.EXTERNAL_COMMAND to it.
2026-11-15 08:23:08 +08:00
+13 -7
Переглянути файл
@@ -246,24 +246,30 @@ mod imp {
}
pub fn process_start() -> Option<std::time::SystemTime> {
#[repr(C)]
#[derive(Default)]
struct FileTime {
low: u32,
high: u32,
}
#[link(name = "kernel32")]
unsafe extern "system" {
// The same signature `memory.rs` declares: FILETIMEs read as packed u64s.
fn GetProcessTimes(
process: *mut std::ffi::c_void,
creation: *mut u64,
exit: *mut u64,
kernel: *mut u64,
user: *mut u64,
creation: *mut FileTime,
exit: *mut FileTime,
kernel: *mut FileTime,
user: *mut FileTime,
) -> i32;
}
let (mut c, mut e, mut k, mut u) = Default::default();
// SAFETY: all out-pointers are valid 64-bit FILETIME slots.
// SAFETY: all out-pointers are valid FILETIME structs.
let ok = unsafe { GetProcessTimes(GetCurrentProcess(), &mut c, &mut e, &mut k, &mut u) };
if ok == 0 {
return None;
}
let ticks = c; // 100 ns since 1601-01-01
let c: FileTime = c;
let ticks = ((c.high as u64) << 32) | c.low as u64; // 100 ns since 1601-01-01
let unix_100ns = ticks.checked_sub(116_444_736_000_000_000)?;
Some(std::time::UNIX_EPOCH + std::time::Duration::from_nanos(unix_100ns * 100))
}