Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC2004-20.12

In this section:
Synopsis

(Required) The time handling functions of time.h shall not be used.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Use of the time.h functions was detected: asctime, clock, ctime, difftime, gmtime, localtime, mktime, strftime, or time. This check is identical to MISRAC++2008-18-0-4, MISRAC2012-Rule-21.10.

Coding standards
MISRA C:2004 20.12

(Required) The time handling functions of time.h shall not be used.

MISRA C:2012 Rule-21.10

(Required) The Standard Library time and date functions shall not be used

MISRA C++ 2008 18-0-4

(Required) The time handling functions of library <ctime> shall not be used.

Code examples

The following code example fails the check and will give a warning:

#include <stddef.h>
#include <time.h>

time_t example(void) {
  return time(NULL);
}

The following code example passes the check and will not give a warning about this issue:

void example(void) {
}