Skip to content

MMDevice: Remove gettimeofday() for Windows#433

Merged
marktsuchida merged 1 commit intomainfrom
remove-windows-gettimeofday
Jan 22, 2024
Merged

MMDevice: Remove gettimeofday() for Windows#433
marktsuchida merged 1 commit intomainfrom
remove-windows-gettimeofday

Conversation

@marktsuchida
Copy link
Member

@marktsuchida marktsuchida commented Jan 22, 2024

It is a bad idea to define functions named like POSIX standard ones, because other people can have the same idea and they can clash (we previously had this issue with Python < 3.7 and gettimeofday()).

Fortunately no device adapter is currently using this function on Windows, so just remove the dead code.

In modern C++, std::chrono offers better time functions for any new code that may need similar facilities.

A few errors corrected in 3 device adapters that used definitions from Windows.h, which is no longer included (without WIN32_LEAN_AND_MEAN) by DeviceUtils.h.

  • Builds on Windows
  • Builds on macOS

It is a bad idea to define functions named like POSIX standard ones,
because other people can have the same idea and they can clash (we
previously had this issue with Python < 3.7 and gettimeofday()).

Fortunately no device adapter is currently using this function on
Windows, so just remove the dead code.

In modern C++, std::chrono offers better time functions for any new code
that may need similar facilities.

A few errors corrected in 3 device adapters that used definitions from
Windows.h, which is no longer included (without WIN32_LEAN_AND_MEAN)
by DeviceUtils.h.
@marktsuchida marktsuchida merged commit 6857bb2 into main Jan 22, 2024
@marktsuchida marktsuchida deleted the remove-windows-gettimeofday branch January 22, 2024 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant