remove time setting command
This commit is contained in:
parent
eb03c8650d
commit
0fcfb25f08
10
main.c
10
main.c
|
@ -153,16 +153,6 @@ static void process_command(char* str)
|
||||||
} else {
|
} else {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else if (0==strcmp(word,"time")) {
|
|
||||||
word = strtok(NULL,delimiter);
|
|
||||||
if (!word) {
|
|
||||||
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 {
|
|
||||||
rtc_set_counter_val(((word[0]-'0')*10+(word[1]-'0')*1)*(60*60)+((word[3]-'0')*10+(word[4]-'0')*1)*60+((word[6]-'0')*10+(word[7]-'0')*1)); // set time in internal RTC counter
|
|
||||||
printf("time set\n");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue