set Unix timestamp: http://www.onlineconversion.com/unix_time.htm

Dependencies:   mbed

Fork of time_HelloWorld by mbed official

main.cpp

Committer:
sandrojuca
Date:
2013-09-18
Revision:
1:62dbcc01f38a
Parent:
0:b3b93997a0a6

File content as of revision 1:62dbcc01f38a:

#include "mbed.h"

DigitalOut led(LED1);

int main() {
    set_time(1379528015);  // Set RTC time Unix timestamp: http://www.onlineconversion.com/unix_time.htm

    while (true) {
        time_t seconds = time(NULL);
        
       // printf("Time as seconds since January 1, 1970 = %d\n", seconds);
        
        printf("Time as a basic string = %s", ctime(&seconds));

       // char buffer[32];
       // strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
       // printf("Time as a custom formatted string = %s", buffer);
        
        wait(1);
        led =! led;
    }
}