If you are using a .NET language, then you should use .NET functions - you could get the time by PInvoke of
GetSystemTime[
^]:
[DllImport("kernel32.dll")]
static extern void GetSystemTime(out SYSTEMTIME lpSystemTime);
But then you need to declare the SYSTEMTIME structure and process it yourself.
[StructLayout(LayoutKind.Sequential)]
public class SystemTime
{
public ushort year;
...
public ushort milliseconds;
}
Providing a wrapper class for the DateTime.Now property would be a better solution.