This code example demonstrates how to set the time with the RTC (real time clock) on a GHI Electronics FEZ board that supports this function.
This code is written in C# and assumes the development workstation has all required software installed.
using System;
using System.Threading
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
public class Program
{
public static void Main()
{
// setting time to 12/1/2011 at 0:00:00
DateTime time = new DateTime(2011, 12, 1, 0, 0, 0);
Utility.SetLocalTime(time);
while (true)
{
Debug.Print(DateTime.Now.ToString());
Thread.Sleep(1000);
}
}
}
For more information on specific namespaces please refer to the following resources: