ENH: cpython.time to expose stdlib time.localtime etc
See original GitHub issueThere is a libc.time
available from which I think I can patch together something equivalent to https://github.com/python/cpython/blob/master/Modules/timemodule.c#L490, but itd be nice to have a canonical version exposed directly.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
time — Time access and conversions — Python 3.11.1 ...
This module provides various time-related functions. ... The time value as returned by gmtime() , localtime() , and strptime() , and accepted by...
Read more >Python | time.localtime() method - GeeksforGeeks
This module comes under Python's standard utility modules. time.localtime() method of Time module is used to convert a time expressed in seconds ...
Read more >Python time-zone handling - LWN.net
to elapsed time (86400 SI seconds) is nuts will inevitably result in subtle errors. Add a civil day to an abstract date?
Read more >A Beginner's Guide to the Python time Module
In this tutorial, you'll learn how to use the Python time module to represent dates and times in your application, manage code execution, ......
Read more >datetime needs an "epoch" method #46988 - python/cpython
Changing time.mktime doesn't seems an option, so the best alternative is to implement a method in datetime type. Is there a real demand...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, apparently, it’s a GNU specific extension. The usual way we deal with those is to add them to the struct if it’s reasonable, because it doesn’t normally hurt to let Cython think they are there as long as users don’t write time into their code. But struct-dict conversion makes this … annoying.
In this case, I would remove the fields. We can add them in some other .pxd file if someone wants them. Does that sound reasonable?
It would be possible to implement this mechanism in the struct-to-dict converter functions in C++11. I’m not really convinced it’s a good idea to have the behaviour vary so much depending on the compiler, but it could be done if there was a real use for it.