bugfix/ai-static-analysis #82

Open
localhorst wants to merge 15 commits from bugfix/ai-static-analysis into master
4 changed files with 128 additions and 109 deletions
Showing only changes of commit d82c45057b - Show all commits

View File

@ -148,12 +148,20 @@ void Drive::setDriveSMARTData(string modelFamily,
void Drive::setTimestamp()
{
time(&this->u32Timestamp);
if (time(&this->u32Timestamp) == -1)
{
// handle error
this->u32Timestamp = 0U;
}
}
void Drive::setActionStartTimestamp()
{
time(&this->u32TimestampTaskStart);
if (time(&this->u32TimestampTaskStart) == -1)
{
// handle error
this->u32TimestampTaskStart = 0U;
}
}
time_t Drive::getActionStartTimestamp()
@ -164,7 +172,11 @@ time_t Drive::getActionStartTimestamp()
void Drive::calculateTaskDuration()
{
time_t u32localtime;
time(&u32localtime);
if (time(&u32localtime) == -1)
{
// handle error
u32localtime = 0U;
}
this->u32TaskDuration = u32localtime - this->u32TimestampTaskStart;
}
@ -178,6 +190,11 @@ void Drive::checkFrozenDrive(void)
{
time_t u32localtime;
time(&u32localtime);
if (time(&u32localtime) == -1)
{
// handle error
u32localtime = 0U;
}
if ((u32localtime - this->u32Timestamp) >= (FROZEN_TIMEOUT * 60) && (this->u32Timestamp > 0) && (this->getTaskPercentage() < 100.0))
{