Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC++2008-18-0-4

In this section:
Synopsis

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

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Uses of time.h functions: asctime, clock, ctime, difftime, gmtime, localtime, mktime, strftime, and time were found. This check is identical to MISRAC2004-20.12, 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

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) {
}