using System;
using System.Collections.Generic;
using Interop.VixCOM;
namespace Vestris.VMWareLib
{
///
/// Helper functions for VMWare interop.
///
public abstract class VMWareInterop
{
///
/// Default timeouts for VMWare operations.
///
public static VMWareTimeouts Timeouts = new VMWareTimeouts();
///
/// Checks whether an error indicates failure and throws an exception in that case.
///
/// Error code.
public static void Check(ulong errCode)
{
if (new VixLib().ErrorIndicatesFailure(errCode))
{
throw new VMWareException(errCode);
}
}
///
/// VMWare VIX date/time is expressed in UNIX EPOCH (number of seconds since January 1st, 1970).
/// Convert VIX date/time into .NET DateTime.
///
/// Unix epoch date/time.
/// DateTime in .NET format.
public static DateTime FromUnixEpoch(long dt)
{
return new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(dt);
}
}
}