macro_rules! win_filetime_from_systemtime {
    ($time:expr) => { ... };
}
Expand description

Converts a std::time::SystemTime into a Windows FILETIME i64 value. (Usually not needed - the systemtime field type does this automatically.)

Usage: let filetime = win_filetime_from_systemtime!(system_time_value);

This macro will convert the provided SystemTime value into a Win32 FILETIME, saturating if the value is out of the range that FileTimeToSystemTime can handle: if the SystemTime value is a date before year 1601, the returned FILETIME value will be the start of 1601, and if the SystemTime value is a date after year 30827, the returned FILETIME value will be the end of 30827.

The returned i64 value can be used with write_event! via the win_filetime and win_filetime_slice field types. As an alternative, you can use the systemtime field type, which will automatically convert the provided std::time::SystemTime value into a FILETIME before writing the event to ETW.

Note: win_filetime_from_systemtime is implemented as a macro because this crate is [no_std]. Implementing this via a function would require this crate to reference std::time::SystemTimeError.