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

iDate.w milliseconds out of sync #34

Open
Vipitis opened this issue Jul 21, 2024 · 1 comment · May be fixed by #37
Open

iDate.w milliseconds out of sync #34

Vipitis opened this issue Jul 21, 2024 · 1 comment · May be fixed by #37
Labels
bug Something isn't working

Comments

@Vipitis
Copy link
Collaborator

Vipitis commented Jul 21, 2024

Implemented way back in pygfx/wgpu-py#428 and had an issue ever since.

milliseconds aren't in sync with seconds. The example clock we have includes milliseconds but it's difficult to spot the problem.

Run for example wgpu-shadertoy https://www.shadertoy.com/view/XXGXzK or wgpu-shadertoy https://www.shadertoy.com/view/ll3yWj and you will easily spot it.

the code in question: (milliseconds are from the perf_counter() used by iTime and iTimeDelta and not the time_struct for iDate)

time_struct = time.localtime()
self._uniform_data["date"] = (
float(time_struct.tm_year),
float(time_struct.tm_mon - 1),
float(time_struct.tm_mday),
time_struct.tm_hour * 3600
+ time_struct.tm_min * 60
+ time_struct.tm_sec
+ now % 1,

I think there are several better solutions, will try a few and hopefully open a PR next week.

@Vipitis Vipitis added the bug Something isn't working label Jul 21, 2024
@Vipitis
Copy link
Collaborator Author

Vipitis commented Aug 13, 2024

would be great to also be able to mock iDate for taking snapshots that are reproducible. So that might be something to consider when addressing this!

@Vipitis Vipitis linked a pull request Sep 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant