2013-02-18 15:32:11 +00:00
|
|
|
#include "mbed.h"
|
2015-01-27 12:51:53 +00:00
|
|
|
#include "test_env.h"
|
2013-02-18 15:32:11 +00:00
|
|
|
|
2014-03-20 15:52:06 +00:00
|
|
|
#define CUSTOM_TIME 1256729737
|
2013-02-18 15:32:11 +00:00
|
|
|
|
2014-03-20 15:52:06 +00:00
|
|
|
int main() {
|
2015-02-11 10:37:03 +00:00
|
|
|
MBED_HOSTTEST_TIMEOUT(20);
|
|
|
|
MBED_HOSTTEST_SELECT(rtc_auto);
|
|
|
|
MBED_HOSTTEST_DESCRIPTION(RTC);
|
|
|
|
MBED_HOSTTEST_START("MBED_16");
|
2015-01-27 12:51:53 +00:00
|
|
|
|
2014-03-20 15:52:06 +00:00
|
|
|
char buffer[32] = {0};
|
|
|
|
set_time(CUSTOM_TIME); // Set RTC time to Wed, 28 Oct 2009 11:35:37
|
2013-02-18 15:32:11 +00:00
|
|
|
while(1) {
|
|
|
|
time_t seconds = time(NULL);
|
2014-03-20 15:52:06 +00:00
|
|
|
strftime(buffer, 32, "%Y-%m-%d %H:%M:%S %p", localtime(&seconds));
|
2014-09-22 09:04:24 +00:00
|
|
|
printf("MBED: [%ld] [%s]\r\n", seconds, buffer);
|
2013-02-18 15:32:11 +00:00
|
|
|
wait(1);
|
|
|
|
}
|
|
|
|
}
|