Skip to content

sys/newlib: gettimeofday() returns time since boot, not current wall time. #9187

@jcarrano

Description

@jcarrano

Description

PR #4286 added support for gettimeofday() by implementing it on top of xtimer_now_usec64().

This definition is in conflict with the specification, which says:

The gettimeofday() function shall obtain the current time, expressed as seconds and microseconds since the Epoch, and store it in the timeval structure pointed to by tp. The resolution of the system clock is unspecified.

Expected results

The current wall time is returned (if the board has a RTC). Otherwise, either the function should be made unavailable (this triggering a linker error if it is used), or it should always fail.

Actual results

gettimeofday() returns time since boot if xtimer was compiled in. If not, it fails with ENOSYS.

Related to

issue: #10523

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: POSIXArea: POSIX API wrapperArea: timersArea: timer subsystemsType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions