-
Notifications
You must be signed in to change notification settings - Fork 157
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
Initial implementation of the time module #1680
Conversation
@gptsarthak perfect, thanks for this! I left some comments. |
I have removed the use of CPython Reference used for implementation : pytime.c#L871
I could not use that function becuase it uses (lp) C:\Users\gptsa\lpython>python examples\timetest.py
Current time : 1680962365.4241385
Answer: 9227465
Time taken : 6.094292402267456
(lp) C:\Users\gptsa\lpython>src\bin\lpython examples\timetest.py
Current time : 1.68096238567989349e+09
Answer: 9227465
Time taken : 1.15024566650390625e-01 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good, thanks!
@gptsarthak do you want to add some tests in a subsequent PR? |
For timing the benchmarks, we currently use the bash
time
command. But that only provides the time in millisecond. Python's time.time() method outputs time in a much higher precision.I have implemented the
time.time()
method here usingUnix Time
after understanding timemodule.cHere is an example:
I will add tests after a review.