static void Main()
    {
        IPConnection ipcon = new IPConnection(); // Create IP connection
        BrickletRealTimeClock rtc = new BrickletRealTimeClock(UID, ipcon); // Create device object

        ipcon.Connect(HOST, PORT); // Connect to brickd
        // Don't use device before ipcon is connected

        // Register date and time callback to function DateTimeCB
        rtc.DateTime += DateTimeCB;

        // Set period for date and time callback to 5s (5000ms)
        // Note: The date and time callback is only called every 5 seconds
        //       if the date and time has changed since the last call!
        rtc.SetDateTimeCallbackPeriod(5000);

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }