Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time API discussion for v3 #272

Open
randy408 opened this issue Nov 18, 2020 · 0 comments
Open

Time API discussion for v3 #272

randy408 opened this issue Nov 18, 2020 · 0 comments

Comments

@randy408
Copy link
Contributor

randy408 commented Nov 18, 2020

Suggestions inspired by #265 and previous discussions:

  • Add int64_t versions of all float time values in ecs_iter_t, ecs_world_info_t, EcsTimer, EcsRateFilter and only use the integers for calculations

  • Change ecs_time_t to a typedef of int64_t or just use int64_t

    • There doesn't appear to be much use of it being an analog of struct timeval/timespec, the seconds member can be int32_t/int64_t depending on platform, high resolution clock functions typically return a 64-bit integer in nanosecond resolution.
  • Change ecs_os_get_time() into a function returning ecs_time_t

  • Register ecs_time_t in flecs-meta?

There's also the question of what unit to use, micro- or nanoseconds. With microsecond resolution we would be throwing away precision, most high-resolution clocks have a frequency of <1 us (https://stackoverflow.com/a/53472916/12771788). Nanoseconds require dividing/multiplying with even bigger constants, but it could be argued that defines should be used for constants (ECS_MS/SEC?) in either case and the code would look the same.

@SanderMertens SanderMertens added this to To do in v3 via automation Apr 13, 2022
@SanderMertens SanderMertens removed this from To do in v3 Aug 1, 2022
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

No branches or pull requests

1 participant