Create new time from existing time structure produces 0 when calculation duration #19217
Heribert17
started this conversation in
General
Replies: 1 comment
-
|
I think we should change the docs of new_time to note about it. Thanks for the analysis. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Environment:
OS: Windows 10
V: V 0.4.0 45e6e7d
I'm new to V and maybe I didn't read the documentation carefully enough.
While translating one of my programs from python to V I have to calculate a time difference. But I always got 0 as difference. So I made a small test program to check that.
After analyzing the time.v and time.c.v files I found, that there is a field named unix. If that field isn't 0 the new_time function in time.c.v returns immediately. In the '-' function in operator.v the unix fields of both times are subtracted. So, as the new_time function doesn't set the unix field new, the returned value is always 0.
To fix that I had to modify the newtime setting in my program to:
I don't know if you would call it a bug or simply a missing hint in the documentation of the new_time function.
Beta Was this translation helpful? Give feedback.
All reactions