adjust printf %u for gcc

This commit is contained in:
King Kévin 2016-08-28 23:15:45 +02:00
parent c7905b43a2
commit f2fb84c7df
1 changed files with 3 additions and 3 deletions

6
main.c
View File

@ -116,7 +116,7 @@ static void process_command(char* str)
} else if (0==strcmp(word,"time")) {
word = strtok(NULL,delimiter);
if (!word) {
printf("current time: %02u:%02u:%02u\n", rtc_get_counter_val()/(60*60), (rtc_get_counter_val()%(60*60))/60, (rtc_get_counter_val()%60)); // get and print time from internal RTC
printf("current time: %02lu:%02lu:%02lu\n", rtc_get_counter_val()/(60*60), (rtc_get_counter_val()%(60*60))/60, (rtc_get_counter_val()%60)); // get and print time from internal RTC
} else if (strlen(word)!=8 || word[0]<'0' || word[0]>'2' || word[1]<'0' || word[1]>'9' || word[3]<'0' || word[3]>'5' || word[4]<'0' || word[4]>'9' || word[6]<'0' || word[6]>'5' || word[7]<'0' || word[7]>'9') { // time format is incorrect
goto error;
} else {
@ -162,7 +162,7 @@ void main(void)
// get date and time
uint32_t ticks_time = 0;
ticks_time = rtc_get_counter_val(); // get time/date from internal RTC
printf("current time: %02u:%02u:%02u\n", ticks_time/(60*60), (ticks_time%(60*60))/60, (ticks_time%60)); // display time
printf("current time: %02lu:%02lu:%02lu\n", ticks_time/(60*60), (ticks_time%(60*60))/60, (ticks_time%60)); // display time
// main loop
printf("command input: ready\n");
@ -217,7 +217,7 @@ void main(void)
rtc_set_counter_val(0); // reset counter
}
if ((ticks_time%(60))==0) { // one minute passed
printf("%02u:%02u:%02u\n", ticks_time/(60*60), (ticks_time%(60*60))/60, (ticks_time%60)); // display external time
printf("%02lu:%02lu:%02lu\n", ticks_time/(60*60), (ticks_time%(60*60))/60, (ticks_time%60)); // display external time
}
}
if (action) { // go to sleep if nothing had to be done, else recheck for activity