mirror of https://github.com/BOINC/boinc.git
Merge pull request #2589 from AenBleidd/fix_2583_daily_schedules
[Manager] Fix time verification to allow '24:00' value in Preferences…
This commit is contained in:
commit
601595b8aa
|
@ -1011,28 +1011,12 @@ bool CDlgAdvPreferences::IsValidTimeValue(const wxString& value) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
//verify correct format and range of time values
|
||||
int h = -1, m = -1;
|
||||
//verify the format itself
|
||||
int parsed = sscanf(value.c_str(), "%d:%d", &h, &m);
|
||||
if (parsed != 2) {
|
||||
return false;
|
||||
}
|
||||
//verify hours
|
||||
if (h < 0 || h > 23) {
|
||||
return false;
|
||||
}
|
||||
//verify minutes
|
||||
if (m < 0 || m > 59) {
|
||||
return false;
|
||||
}
|
||||
//all chars are valid, now what is with the value as a whole ?
|
||||
if (value == wxT("24:00")) return true;
|
||||
wxDateTime dt;
|
||||
const wxChar* stopChar = dt.ParseFormat(value, wxT("%H:%M"));
|
||||
if(stopChar==NULL && value != wxT("24:00")) {
|
||||
// conversion failed
|
||||
return false;
|
||||
}
|
||||
if (stopChar == NULL) return false; // conversion failed
|
||||
if (*stopChar != '\0') return false; // conversion failed
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue