//----------------------------------------------------------------------------
//
// Copyright (c) Intel Corporation, 2009-2014 All Rights Reserved.
//
// File: TimeSynchronizationFunctionality.cs
//
// Contents: Demonstrate the IBootControl interface.
//
//
//----------------------------------------------------------------------------
using System;
using Intel.Manageability;
using Intel.Manageability.TimeSynchronization;
namespace TimeSynchronizationSample
{
class TimeSynchronizationFunctionality
{
///
/// Set the Intel AMT network time using the Time Synchronization service, to Coordinated Universal Time (UTC).
///
/// The Intel AMT instance
public static void SetNetworkTime(IAMTInstance amt)
{
try
{
amt.TimeSynchronization.SetUtcNetworkTime();
Console.WriteLine("Set the Utc Intel AMT network time succeed.");
}
catch (Exception e)
{
Console.WriteLine("Set the Intel AMT time failed");
Console.WriteLine("\n" + e.Message);
}
}
///
/// Get the Intel AMT network time.
///
/// The Intel AMT instance
public static void GetNetworkTime(IAMTInstance amt)
{
try
{
DateTime dateTimeOfAmt = amt.TimeSynchronization.GetNetworkTime();
Console.WriteLine("The current Intel AMT network time is {0}", dateTimeOfAmt.ToString());
}
catch (Exception e)
{
Console.WriteLine("Get the Intel AMT network time failed");
Console.WriteLine("\n" + e.Message);
}
}
///
/// Get the enabled state of the time sync.
///
/// The Intel AMT instance
public static void GetSyncTimeEnabledState(IAMTInstance amt)
{
try
{
SyncTimeEnabledState syncTimeEnabledState = amt.TimeSynchronization.GetSyncTimeEnabledState();
Console.WriteLine("The enabled state of the time sync is {0}", syncTimeEnabledState.ToString());
}
catch (Exception e)
{
Console.WriteLine("Get Sync Time Enabled State failed");
Console.WriteLine("\n" + e.Message);
}
}
///
/// Enable/Disable the time sync.
///
/// The Intel AMT instance
public static void SetSyncTimeState(IAMTInstance amt)
{
try
{
amt.TimeSynchronization.SetSyncTimeState(true);
Console.WriteLine("Set the Sync Time state of Intel AMT network time succeed.");
}
catch (Exception e)
{
Console.WriteLine("Set the Intel AMT sync time state failed");
Console.WriteLine("\n" + e.Message);
}
}
///
/// Get the setter of the network time.
///
/// The Intel AMT instance
public static void GetTimeSetter(IAMTInstance amt)
{
try
{
TimeSetter timeSetter = amt.TimeSynchronization.GetTimeSetter();
Console.WriteLine("The Intel AMT time setter is {0}", timeSetter);
}
catch (Exception e)
{
Console.WriteLine("Get time setter of Intel AMT failed");
Console.WriteLine("\n" + e.Message);
}
}
}
}