]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/tests/mbed/rtc/main.cpp
Merge commit '1fe4406f374291ab2e86e95a97341fd9c475fcb8'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / tests / mbed / rtc / main.cpp
1 #include "mbed.h"
2 #include "test_env.h"
3
4 #define CUSTOM_TIME 1256729737
5
6 int main() {
7 MBED_HOSTTEST_TIMEOUT(20);
8 MBED_HOSTTEST_SELECT(rtc_auto);
9 MBED_HOSTTEST_DESCRIPTION(RTC);
10 MBED_HOSTTEST_START("MBED_16");
11
12 char buffer[32] = {0};
13 set_time(CUSTOM_TIME); // Set RTC time to Wed, 28 Oct 2009 11:35:37
14 while(1) {
15 time_t seconds = time(NULL);
16 strftime(buffer, 32, "%Y-%m-%d %H:%M:%S %p", localtime(&seconds));
17 printf("MBED: [%ld] [%s]\r\n", seconds, buffer);
18 wait(1);
19 }
20 }
Imprint / Impressum