Git Product home page Git Product logo

Comments (8)

christian-rauch avatar christian-rauch commented on August 27, 2024

What's the advantage of using #define WIN32_LEAN_AND_MEAN? According to https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers:

Define WIN32_LEAN_AND_MEAN to exclude APIs such as Cryptography, DDE, RPC, Shell, and Windows Sockets.

So it makes sense that some included headers would then be missing.

from apriltag.

mitjap avatar mitjap commented on August 27, 2024

Excluding rarely used headers reduces namespace pollution and improves build time. If one want to use it this library should not stand in the way if possible. Instead of including a very general header it should include exactly what it needs.

Here is the link to the fix that we use: modriplanetdoo@45a0a70

from apriltag.

christian-rauch avatar christian-rauch commented on August 27, 2024

With the diff I better understand what you aim for. I initially understood that you want to use the windows.h header with #define WIN32_LEAN_AND_MEAN and then additionally add the winsock.h header, which would be counterintuitive in my view. Feel free to send a PR with this patch. Also add the required compile flags to the CI in order to make sure that this will not break in future.

Is timeval only directly defined in winsock.h? Is there no specific "time" header that includes this struct?

from apriltag.

mitjap avatar mitjap commented on August 27, 2024

As specified in documentation timeval is defined in winsock.h. It it also recommended to use Winsock2.h which is recommended version of this header.

https://learn.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-timeval
Header winsock.h (include Winsock2.h)

I am not aware of any other time-related header.

from apriltag.

brmarkus avatar brmarkus commented on August 27, 2024

Why is struct timeval (still) used at all might be the question... instead of a plain, standard C or C++ way of dealing with "time"?

from apriltag.

christian-rauch avatar christian-rauch commented on August 27, 2024

Why is struct timeval (still) used at all might be the question... instead of a plain, standard C or C++ way of dealing with "time"?

Do you know of a standard C way of dealing with time at microsecond resolution?

from apriltag.

brmarkus avatar brmarkus commented on August 27, 2024

A quick pointer could be "https://stackoverflow.com/a/67731965" (https://stackoverflow.com/questions/5833094/get-a-timestamp-in-c-in-microseconds/67731965#67731965).

Haven't grepped AprilTag for where timeval is used... why is a timestamp needed to process AprilTags ;-) ?

from apriltag.

christian-rauch avatar christian-rauch commented on August 27, 2024

A quick pointer could be "https://stackoverflow.com/a/67731965" (https://stackoverflow.com/questions/5833094/get-a-timestamp-in-c-in-microseconds/67731965#67731965).

The response you linked recommends not using timespec_get. So in the end, you are left with the native APIs. The question and the answer are using the POSIX function gettimeofday which is also the one used here.

Haven't grepped AprilTag for where timeval is used... why is a timestamp needed to process AprilTags ;-) ?

The time is used for profiling.

from apriltag.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.