Skip to content

implementation header suggested for struct timeval #64336

@firewave

Description

@firewave
#include <sys/time.h>

void f()
{
    struct timeval tv;
    tv.tv_sec = 1;
    tv.tv_usec = 0;
    (void)tv;
}
<source>:1:1: warning: included header time.h is not used directly [misc-include-cleaner]
    1 | #include <sys/time.h>
      | ^~~~~~~~~~~~~~~~~~~~~
    2 | 
<source>:5:12: warning: no header providing "timeval" is directly included [misc-include-cleaner]
    1 | #include <sys/time.h>
    2 | 
    3 | void f()
    4 | {
    5 |     struct timeval tv;
      |            ^
2 warnings generated.

clang-include-cleaner-17 --print=changes reports:

- <sys/time.h> @Line:1
+ <bits/types/struct_timeval.h>

See
https://pubs.opengroup.org/onlinepubs/7908799/xsh/systime.h.html
https://man7.org/linux/man-pages/man2/settimeofday.2.html

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions