Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The type time_t is specified as an "arithmetic type capable of representing times." However, how the way time is encoded within this arithmetic type by the function time() is unspecified. See unspecified behavior 46 in section J.1 of the C Standard [ISO/IEC 9899:2011]. Because the encoding is unspecified, there is no safe way to manually perform arithmetic on the type, and as a result, the values should not be modified directly.

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

...

ISO/IEC 9899:2011 Section 7.27, "Date and time <time.h>"

Sources

Bibliography

[Kettlewell 2002]Section 4.1, "time_t"

 

...