Simple program to access time from mbed's internal RTC Battery needs to be connected to specified pins on manual

Dependencies:   mbed

Revision:
0:3bcda94a334a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 08 00:54:40 2014 +0000
@@ -0,0 +1,27 @@
+//Author: Kuldip Maharjan
+//Email : kuldipmaharjan@gmail.com
+//Anyone can use this code if it helps in their projects or
+//for learning programing in mbed besides for commercial purposes
+
+//Simple program to access time from mbed's internal RTC
+//Battery needs to be connected to specified pins on manual
+
+#include "mbed.h"
+
+Serial pc(p9, p10); // tx, rx
+int main()
+{
+    pc.baud(115200);
+    set_time(1361223433);  // http://www.epochconverter.com/
+
+    while (true) {
+        time_t seconds = time(NULL);
+        pc.printf("Time as a basic string = %s \n", ctime(&seconds));
+
+        //char buffer[32];
+        // strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
+        //pc.printf("Time as a custom formatted string = %s", buffer);
+
+        wait(1);
+    }
+}
\ No newline at end of file