Dependencies:   EthernetNetIf NTPClient_NetServices mbed

Revision:
0:8c53aefc68af
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NTPClientExample.cpp	Mon Jun 14 10:27:40 2010 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "NTPClient.h"
+
+EthernetNetIf eth; 
+NTPClient ntp;
+  
+int main() {
+
+  printf("Start\n");
+
+  printf("Setting up...\n");
+  EthernetErr ethErr = eth.setup();
+  if(ethErr)
+  {
+    printf("Error %d in setup.\n", ethErr);
+    return -1;
+  }
+  printf("Setup OK\r\n");
+  
+  time_t ctTime;
+  ctTime = time(NULL);  
+  printf("Current time is (UTC): %s\n", ctime(&ctTime));  
+
+  Host server(IpAddr(), 123, "0.uk.pool.ntp.org");
+  ntp.setTime(server);
+    
+  ctTime = time(NULL);  
+  printf("\nTime is now (UTC): %s\n", ctime(&ctTime)); 
+  
+  while(1)
+  {
+  
+  }
+  
+  return 0;
+  
+}