Opc.Ua.Com.ComUtils.GetFILETIME C# (CSharp) Method

GetFILETIME() public static method

Marshals a DateTime as a WIN32 FILETIME.
public static GetFILETIME ( System.DateTime datetime ) : System.Runtime.InteropServices.ComTypes.FILETIME
datetime System.DateTime The DateTime object to marshal
return System.Runtime.InteropServices.ComTypes.FILETIME
		public static System.Runtime.InteropServices.ComTypes.FILETIME GetFILETIME(DateTime datetime)
		{
			System.Runtime.InteropServices.ComTypes.FILETIME filetime;

			if (datetime <= FILETIME_BaseTime)
			{
				filetime.dwHighDateTime = 0;
				filetime.dwLowDateTime  = 0;
				return filetime;
			}

			// adjust for WIN32 FILETIME base.
			long ticks = 0;
			ticks = datetime.Subtract(new TimeSpan(FILETIME_BaseTime.Ticks)).Ticks;
		
			filetime.dwHighDateTime = (int)((ticks>>32) & 0xFFFFFFFF);
			filetime.dwLowDateTime  = (int)(ticks & 0xFFFFFFFF);

			return filetime;
		}